View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier[_7_] Jon Peltier[_7_] is offline
external usenet poster
 
Posts: 115
Default Macro to create pivot table/ chart

Even better, use something like
Range("A1").CurrentRegion.Address(xlReferenceStyle :=xlR1C1)
or
ActiveSheet.UsedRange.Address(xlReferenceStyle:=xl R1C1)
This makes it much easier than keeping track of the size of the data range.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Spammastergrand wrote:

Try recording a macro that creates a table. Then go back and change the range.
It usually will be in a R1C1 format.
You can create a variable that stores the last row like

Dim Lrow as integer, MyRange as string

Lrow = sheets(1).range("A65000")end(xlup).row

MyRange = "A5:H" & Lrow

then substitute the R1C1 in the code with range(MyRange)