Excel Macro - Pivot Table, Dynamic Range, Error Handling - Excel VBA Part 11

Поділитися
Вставка
  • Опубліковано 11 вер 2024

КОМЕНТАРІ • 121

  • @Kurkess
    @Kurkess 4 роки тому +20

    This is the best explanation to creating a pivot table from Dynamic Range I've been able to find. So many unnecessary complications on some of the other websites and videos. Thanks man.

  • @jeetcaresforyou3221
    @jeetcaresforyou3221 Місяць тому +1

    Dude, you solved my long time problem in minutes, I was desperately looking for this video, Thanks a ton.

  • @ashleynewberry698
    @ashleynewberry698 3 роки тому +5

    I have been struggling with this issue for way too long than I care to admit. Thank you so much for explaining it in simple terms and not trying to make it complicated.

  • @michaellawton6918
    @michaellawton6918 3 роки тому +2

    I was getting very frustrated trying to create a Pivot table by recording. This worked perfectly. Thank you.

  • @nazarkamal8831
    @nazarkamal8831 Рік тому +1

    Atlast I found the correct UA-cam channel for What I exactly want

  • @ameensams
    @ameensams 4 роки тому +1

    You just fixed a problem I gave up on yesterday by doing what I wouldn't advise anyone to do in coding. Thanks, you are a blessing !!!

  • @jdub4245
    @jdub4245 7 місяців тому +1

    Awesome tutorial, thank you for taking the time and sharing!

  • @evandixon1990
    @evandixon1990 3 роки тому +2

    You Sire are a Legend and a Scholar! Thank you!

  • @srinivasannarayanaswami5378
    @srinivasannarayanaswami5378 3 роки тому +2

    Simply Awesome....loved it. Thanks a lot for this lucid tutorial!

  • @sandrakaczka1504
    @sandrakaczka1504 3 роки тому +1

    Thank you. Your explanation was clear and this helped me complete the macro without giving up.

  • @stevenl119
    @stevenl119 Рік тому

    Excellent explanation. Wish I saw this video first. Would of saved me hours trying to find the answer.

  • @manishjain6317
    @manishjain6317 2 роки тому +1

    excellent explanation

  • @deepanshitayal4534
    @deepanshitayal4534 4 роки тому +2

    This trick worked! Thank you for the video!

  • @takuyamurami6423
    @takuyamurami6423 3 роки тому +1

    This is very workable pivot macro! Thank you.

  • @joymdemeka4036
    @joymdemeka4036 2 роки тому

    The best video so far....Hope to learn more from you. Thank you so much

  • @parvindersingh5780
    @parvindersingh5780 2 роки тому

    Amazing explaination. Simple and easy to grab. :) Thank you so much for sharing.

  • @Dexter_1012
    @Dexter_1012 4 місяці тому

    This helped! Thanks a lot for making this video !!! :)

  • @vninad
    @vninad 7 місяців тому

    This video was really helpful. Thanks buddy !

  • @nazarkamal8831
    @nazarkamal8831 Рік тому

    This is what I exactly 💯 want without unwanted things !!! How to auto genarate pivot VBA excel macro thanks man

  • @hamzaoulmouden3411
    @hamzaoulmouden3411 4 роки тому

    Great video, I'm glad I have found this channel.
    I have a couple of questions :
    What if we had already an existent sheet where we want to place the pivot table ? What should we change in this case ?
    What do we do to stop the macro from creating several sheets with the same outcome every time we execute this code ?

  • @deepusuprabha
    @deepusuprabha 2 роки тому

    Thanks Super. I really happy to see this type of videos

  • @fawaddar9015
    @fawaddar9015 3 роки тому

    you are a legend Sir! thanks for the easy example

  • @jordantijerina1247
    @jordantijerina1247 6 місяців тому

    You are a god, thank you so much

  • @felipegarduno7949
    @felipegarduno7949 2 роки тому

    Excellent training. Good job!

  • @subhodipta
    @subhodipta 3 роки тому +1

    Very informative & helpful. Just wanted to know why I am not able to run the micro if i do the pivot on the same worksheet? What changes need to be made?

  • @beibeiilovu
    @beibeiilovu 3 роки тому +1

    Thanks for sharing.

  • @carlie0827
    @carlie0827 2 місяці тому

    You saved my career

  • @gamezon7648
    @gamezon7648 2 роки тому

    Man, you are awsomeee, do more of those plz.

  • @neerajsinha1265
    @neerajsinha1265 2 роки тому

    Quite helpful. Thankyou ! for sharing

  • @bigliss9040
    @bigliss9040 3 роки тому

    Thank you! You are a genius!!!!!!!!!!

  • @sachinsebastian8100
    @sachinsebastian8100 2 роки тому

    Thank you so much for this video!

  • @talhaakram3621
    @talhaakram3621 Рік тому

    Bro! I just love you 😘😘😘😘😘😘😘

  • @piyush.mh9
    @piyush.mh9 3 роки тому +1

    Thanks!

  • @luisochoa3588
    @luisochoa3588 Рік тому

    Thanks a lot man, this is the best explanation I watched and helped me a lot. I only have a question about; it could be possible associate the datasource to a the active sheet in the book that somene is using no matter the names of the others sheets. I mean, is it possible to execute the same macro in every workbook's sheet?

  • @sasavienne
    @sasavienne 4 роки тому

    Thank you for sharing this truly useful video. 👏 🌟 🌟

  • @janbenedictandrade5718
    @janbenedictandrade5718 2 роки тому

    Great Video and tutorial good sir! You've taught me how to understand VBA. But I have a question, How do I make column range dynamic as well?

  • @shubhamshan9197
    @shubhamshan9197 2 роки тому

    Thank u sir
    You information is very helpfull for my job👍

  • @Mr.IvanMiller
    @Mr.IvanMiller 9 місяців тому

    What do I do if I need to create multiple Pivot Tables within the same worksheet? Do I have to rename the 'pivotWS' for each pivot table? (ie., pivotWS1 for the first pivot table and then pivotWS2 for another one?

  • @Nitintomar9996
    @Nitintomar9996 8 місяців тому

    Please help. In your video yiu have told how to take data upto the last row. I need to know how can we take data upto the last second row of data. How to work it out in VBA. Please reply.

  • @pawanrai937
    @pawanrai937 2 роки тому

    Thanks, Great Help 💻💻 Best Explaination

  • @mohammedwazni7569
    @mohammedwazni7569 2 роки тому

    Ater hours of searching, found all I need in this video. But one last thing, is there a way I could get the additional columns of data I add? Like you did to get additional rows of data you added

  • @kalebrogers7818
    @kalebrogers7818 4 роки тому

    Thanks for the video and information! Is there a way to use last row and last column as the pivot table range?

  • @jaydeepmitra8216
    @jaydeepmitra8216 8 місяців тому

    Getting a message that the macro cannot run in break mode. What is it?

  • @UFOBR
    @UFOBR 2 роки тому

    Good!

  • @anjoesebastian1900
    @anjoesebastian1900 6 місяців тому

    Hi Brother, My code shows error when I change to "'" & dataWS & "'!A1:F" Could you please help ???

  • @catherineshuttleworth6633
    @catherineshuttleworth6633 2 роки тому

    Pivot in same worksheet - I have recorded the macro placing the pivot table in the same worksheet - however when I rerun the macro it stops at the following point:
    Range("V2").Select
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    "Table1", Version:=6).CreatePivotTable TableDestination:= _
    "New Hires_SAP_KDVS02!R2C22", TableName:="PivotTable3", DefaultVersion:=6
    How can I fix this?

  • @user-zt8kk3ys9v
    @user-zt8kk3ys9v 4 роки тому +1

    amazing

  • @jaichander87
    @jaichander87 3 роки тому

    Hey! Is there any way to make pivot table by dynamic column... You shows dynamic rows...plz tell me dynamic column also

  • @ninakadu3531
    @ninakadu3531 4 роки тому

    I have a Master data sales report . I slice the data into separate worksheets by customer name wise. The number of rows on each sheet vary depending upon data each month. I need a macro to create a pivot table at the bottom of the data on each sheet for further working. I tried after watching this video but it's not working. Please help

  • @shankarsinghrathore9502
    @shankarsinghrathore9502 4 роки тому

    Text values in value field gets converted to number.. But i want it to remain as text... I have recorded it by adding data model and using ConcateneX but this doesn't work for other sheets.
    Could u please tell how to add datamodel and give text in pivot table value filed.

  • @hellostranger5417
    @hellostranger5417 25 днів тому

    Bro You missed to tell how the last column code works, as for my data column increases

  • @NehaSharma-pr3ms
    @NehaSharma-pr3ms 4 роки тому +1

    Facing issues while specifying the source data from R1C1 syntax to regular syntax , throwing me pivot table field name is not valid

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 роки тому +1

      Make sure you include headers in your range and there should be no blanks or duplicate names in headers.

    • @flora0427
      @flora0427 3 роки тому

      @@ExcelGoogleSheets I'm having the same issue, but I made sure the format was exactly like what you did in your video. Any help would be greatly appreciated!

  • @sugiplanner
    @sugiplanner 2 роки тому

    It's easy when the header of table no change..
    How if the header change?

  • @BGLee-rh8sh
    @BGLee-rh8sh Рік тому

    How can I create Macro If i need filter the data?

  • @paulinavillalobosorozco9349
    @paulinavillalobosorozco9349 4 роки тому

    love you

  • @kartickchakraborty9135
    @kartickchakraborty9135 2 роки тому +1

    Sir, would you kindly make a video on "How to split number and text from an Alphanumeric String through VBA UDF?"

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому +1

      Power Query has a build-in solution for this. Does it have to be VBA?

    • @kartickchakraborty9135
      @kartickchakraborty9135 2 роки тому

      @@ExcelGoogleSheets Sir, I've been your subscribers for years. Please make a video on this topic.
      Yes sir, it has to be through VBA. Because we are working on office 2007. So there is no Power Query and PowerPivot.

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      Check this out stackoverflow.com/questions/48513694/excel-vba-split-numbers-and-text-from-a-string-into-columns

  • @akhileshreddy0910
    @akhileshreddy0910 Рік тому +1

    When ever i add variable as pivotws & "!R3C1"
    It is throwing an error as invalid procedure call or argument (error 5)
    Please give me a solution for it 4:23
    Whenever I use concatenation it is giving the error

  • @adityasvasisht4743
    @adityasvasisht4743 4 роки тому

    Thank for this informative video. Could you explain what to do if the field is the same for column area as well as the Value area?
    because then, it only considers the field in the value area and continues to run the subroutine.

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 роки тому

      If you move .AddDataField line above .PivotFields with blocks, it should fix your problem.

  • @gauthamambethkar4483
    @gauthamambethkar4483 4 роки тому

    The explanation is good. I have tried this in my computer and it works fine. But I have a doubt. How does it not through an error as the variable is not declared?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 роки тому +2

      It will only force you to declare variables if you have Option Explicit on top.

  • @saurabhprajapati3753
    @saurabhprajapati3753 3 роки тому

    Thanks for the information, just wanted to know, if i want to name the output tab any specific other than "sheet 2", how can i do that? Also will it work for multiple pivots in different tabs from sheet 1 in same sheet?
    Thanks in advance!

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 роки тому

      Add
      activesheet.name = "New Name"
      by the end of the code
      and yes.

  • @AmanKumar-ps2pg
    @AmanKumar-ps2pg Рік тому

    Hi, I am getting "Compile Error : Variable not defined", when I add pivotWS variable. Do I need to change some setting?

    • @AmanKumar-ps2pg
      @AmanKumar-ps2pg Рік тому

      I was using Open Explicit. Removing that solved it.

  • @sookitgoh7391
    @sookitgoh7391 2 роки тому

    I’m facing an issue where I’m in the middle of recording a macro with pivot table and when I click the “Do Not Show Subtotals” button under Design tab, where’s an error pops up saying “unable to record”. Is there anyway to solve this? Thanks

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      Try adding this step manually instead of recording,
      Dim PvtTbl As PivotTable
      Dim pvtFld As PivotField
      Set PvtTbl = ActiveSheet.PivotTables(1)
      'hide Subtotals for all fields in the PivotTable .
      With PvtTbl
      For Each pvtFld In .PivotFields
      pvtFld.Subtotals(1) = True
      pvtFld.Subtotals(1) = False
      Next pvtFld
      End With

  • @KK-mf6su
    @KK-mf6su Рік тому

    Sir, it occur a “424” error (object required), in debugger, it highlighting “lr=Cells(Row.Court. 1).End(xlUp).Row”, how can I solve it? Thank you.

  • @lastdecember2496
    @lastdecember2496 3 роки тому

    why does it seems that you can assign var right away, while me need to declare it first ? like 'dim Name As String' ??

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 роки тому +1

      If you remove "option explicit" on top then you won't have to declare the variables.

  • @praveenchauhandilse..166
    @praveenchauhandilse..166 4 роки тому

    Hey, after giving pivotWS as activesheet name, still getting error, "Can't execute code in breaking mode"?

  • @RakeshKumar-df3sg
    @RakeshKumar-df3sg 8 місяців тому

    I am getting error as Cannot execute code in break mode. Please help

  • @shantanubadadare9522
    @shantanubadadare9522 4 роки тому

    It is not working for me.I changed the name from Sheet2 to PivotWS as per the video,bt it didnt work out,I am using excel 2013.Please let me know any other solution.
    I need this urgently.

  • @gurunathan-ed3yx
    @gurunathan-ed3yx 2 роки тому

    I followed the same as you have told in this video but I was getting a error stating "cant execute code in break mode"

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      Hit "reset" button. Same as stop button on old players.

    • @naseebk5228
      @naseebk5228 2 роки тому

      @@ExcelGoogleSheets I got same error and fixed by reset button
      thanks a lot

  • @Niks_life_lens
    @Niks_life_lens Рік тому

    huh complex explanation

  • @lokeshn1204
    @lokeshn1204 2 роки тому

    Thanks for this video, how to change the Pivot sheet name

  • @christiangonzales9851
    @christiangonzales9851 2 роки тому

    Mine says can't execute in break mode. Help

  • @parkerrustmann9444
    @parkerrustmann9444 9 місяців тому

    I literally cannot get this to work

  • @annapetmikel4356
    @annapetmikel4356 2 роки тому

    Hi, when i write: TableDestination _
    := pivotWS&"!R3C1" I get Compile error Expected: end of statement. Could somebody help here?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      try adding a space before and after &

    • @annapetmikel4356
      @annapetmikel4356 2 роки тому

      @@ExcelGoogleSheets thanks, I did. but have got another kind of error for the last line in this code: ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
      "08.04.2022 (2)!R1C1:R19C9", Version:=6).CreatePivotTable TableDestination _
      :=pivotWS & "!R3C1", TableName:="PivotTable1", DefaultVersion:=6

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      @@annapetmikel4356 You didn't update SourceData like mentioned in the video.

  • @phanivadlamani2127
    @phanivadlamani2127 3 роки тому

    Thanks for the video. Can I add a name to the new worksheet?

  • @pankajnestlema
    @pankajnestlema 2 роки тому

    Hi This is not worked in office 365

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      It works fine in office 365 so long as you are not using the web browser version.

  • @AMG19961
    @AMG19961 3 роки тому

    i got error after following ur steps

    • @AMG19961
      @AMG19961 3 роки тому

      it gives me error when i try to use A1 and F22 formula

  • @noelalmanza6914
    @noelalmanza6914 2 роки тому

    I followed step by step, when I added lr and tested the Macro, I get the error '1004' saying Pivottable Field name not valid. Here is code:
    Sub PivotEmployeesPriojectTask()
    '
    ' PivotEmployeesPriojectTask Macro
    ' Pivot employees on project-task by earnings period end date.
    '
    '
    lr = Cells(Rows.Count, 1).End(xlUp).Row

    Sheets.Add
    pivotWS = ActiveSheet.Name

    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    "Salary-Fringe Combined_1!A1:BO" & lr, Version:=6).CreatePivotTable _
    TableDestination:=pivotWS & "!R3C1", TableName:="PivotTable1", _
    DefaultVersion:=6
    Sheets(pivotWS).Select
    Cells(3, 1).Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("CCOA TASK Code")
    .Orientation = xlRowField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Employee Name")
    .Orientation = xlRowField
    .Position = 2
    End With
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Employee ID")
    .Orientation = xlRowField
    .Position = 3
    End With
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Transaction Type")
    .Orientation = xlRowField
    .Position = 4
    End With
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Journal Template Code" _
    )
    .Orientation = xlRowField
    .Position = 5
    End With
    With ActiveSheet.PivotTables("PivotTable1").PivotFields( _
    "Earnings Period End Date")
    .Orientation = xlColumnField
    .Position = 1
    End With
    ActiveSheet.PivotTables("PivotTable1").PivotFields("Earnings Period End Date"). _
    AutoGroup
    ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
    "PivotTable1").PivotFields("Monetary Amount"), "Sum of Monetary Amount", xlSum
    Range("B8").Select
    With ActiveSheet.PivotTables("PivotTable1").PivotFields( _
    "Sum of Monetary Amount")
    .NumberFormat = "$#,##0.00"
    End With
    End Sub

    • @noelalmanza6914
      @noelalmanza6914 2 роки тому

      Any help on this would be greatly appreciated!

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      Which line is highlighted in yellow when you get this error?

  • @benheiner6882
    @benheiner6882 2 роки тому

    Thanks!