View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Pivot Table(s) - refresh in sheet - macro - automate

Robert(pepe)

1) Generally, an object has three options:

[object].[subobject]
[object].[property]
[object].[method]

For example:

Worksheets(1).Range("A1")
Worksheets(1).Visible
Workbooks(1).Move

and each subobject can have all three options.

2) The macro recorder is your best friend when you are trying to learn VBA coding: selecting a cell
within a PT, then using the Pivot Table Commandbar: Pivot Table / Select / Entire Table, you
get:

ActiveSheet.PivotTables("PivotTable1").PivotSelect "", xlDataAndLabel, True


HTH,
Bernie
MS Excel MVP


"pepenacho" wrote in message
...
Bernie:

It worked fine thank you!! I have two short follow up questions.

Question 1) Is there a general standard/order to the syntax for objects in vb?
I.e. for

ActiveSheet.PivotTables

Such that i.e.

[object class].[specific object].[event on object].[etc].[etc].[etc].[etc]

Furthermore, when I explore the object library in the VB editor, I cannot
seem to find any definitions/discussion on how to use what I find, in order
to help myself differentiate and test!, if I've found the right thing. Am I
missing something?

Question 2) Let's say that i have a PivotTable called PivotTable1. I now
want to write a subprocedure to select the entire PivotTable, in order to
copy the information. Because the boundry of a PivotTable is a "moving
target" is there an object or a property that can be written and that will
select the entire PivotTable regardless of its current width or length?

Thanks,
Robert (pepe)