pivot tables vba

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Pivot tables in VBA

Pivot tables in VBA

resolvedResolved · Low Priority · Version 2003

Grant has attended:
Excel VBA Intro Intermediate course
Excel VBA Intro Intermediate course

Pivot tables in VBA

When working the VBA pivot examples with Carlos we discovered that the code we used to select the underlying database broke down when there were gaps in the data in the rightmost column i.e. it would no longer select the full database, stopping at the row with the gap. I would be grateful for an answer on how to adjust the code to select the full dataset even if there was a hole (empty cells) in the data. Thank you!

RE: pivot tables in VBA

Hi Grant

Since in most data tables the first cell has always got data in it by using CurrentRegion you can select the whole table even if some cells in the first and last columns are blank

Set DataRange = Range("A9").CurrentRegion


Hope this helps

Carlos

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Multiple Lines of Text in a Cell

As an alternative to the Text Wrapping facility, type a word or two, press Alt+Enter to get a new line, type more text, and continue the process for as many lines as you need. Enter as normal when you have finished.

The line break is not affected by changing the column width, as text wrapping. To remove this you must edit the cell and remove the invisible character and replace with a normal space.

View all Excel hints and tips


Server loaded in 0.08 secs.