Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically Determine last row and column
Paul
Dim lrow As Long, lcol as Long lrow = Cells(Rows.COUNT, "A").End(xlUp).Row ' change to what ever column you want. lcol = ActiveSheet.Range("IV1").End(xlToLeft).Column ' change to what ever row you want -- sb "Paul Hastings" wrote in message ... Hi - I am trying to automatically generate a Pivot Table from data that has been pulled into a worksheet from a database. The data always starts in R1C1, but the extent is variable. Here is an example: ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _ "SP1a!R1C1:R6897C21").CreatePivotTable TableDestination:="", TableName:= _ "PivotTable1" Its the "R6897C21" part I want to fix. How can I determine the last row and column that has data in it so I can change this based on my actual data? Thanks, Paul Hastings Principal Computer Scientist Jorge Scientific Corporation 104 Park Drive Warner Robins, GA 31088 (478) 923-2662 x122 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Determine a result of one column based on conditions in two column | Excel Discussion (Misc queries) | |||
How do I determine the last cell in a Column | Excel Discussion (Misc queries) | |||
Setting up an Excel sheet to automatically determine when an employeeshould enter a retirement plan, perhaps What-If Analysis would help? Anyother suggestions? | Links and Linking in Excel | |||
Determine if Value in column A exists in Column B | Excel Discussion (Misc queries) | |||
How do I determine automatically that a sheet is empty? | Excel Worksheet Functions |