Finding the last cell in a range
Do as follow:
Use a column that will have value in every row.
Assume column A
range("A2").select
ActiveCell.End(xlDown).Select
LastRow = ActiveCell.Row
SourceData:= _
"'RWA Data'!R1C1:R" & LastRow
& "C19").CreatePivotTable
range("A2').select
This should work
Andres
-----Original Message-----
I have a few macros that select a range of cells. I
occassionally delete the contents of the RWA Data sheet
and paste in new information that contains the same
number
of columns, but the number of rows will always change.
The follwing is an example of some code from one of my
macros. I will always be selecting " 'RWA Data' !R1C1:
but the last row will change. What code can I add that
will look at the last cell in a list that my cursor is in?
Thanks much,
Alex
Range("E14").Select
ActiveWorkbook.PivotCaches.Add
(SourceType:=xlDatabase,
SourceData:= _
"'RWA Data'!R1C1:R3502C19").CreatePivotTable
TableDestination:="", TableName _
:="PivotTable1"
.
|