Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Select rows in pivot table with macro
Hi,
I have a pivot table as follows: Doc Tx Amount 123 12 5 124 11 2 125 12 3 (blank) (blank) Grand Total 10 I need a macro to select the cells in the 2nd row (row just below the header) - only 3 columns and not the entire row - up to the row just before the row with (blank). How do I do that? Thanks, Dolphinv4 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Select rows in pivot table with macro
Paste this macro into a VBA module in your workbook. Make sure the sheet with
the pivot table is the active sheet, then run the macro (Tools Macro Macros SelPivotTblCells Run). Sub SelPivotTblCells() Dim Rng As Range, EndRow As Long, c Set Rng = ActiveSheet.PivotTables(1).RowRange Rng.Cells(2, 1).Activate Set c = Rng.Find(What:="(blank)", LookIn:=xlValues) If c Is Nothing Then MsgBox "(blank) not found" Exit Sub End If Range(Rng.Cells(2, 1), Cells(c.Row - 1, 3)).Select Set Rng = Nothing Set c = Nothing End Sub Hope this helps, Hutch "Dolphinv4" wrote: Hi, I have a pivot table as follows: Doc Tx Amount 123 12 5 124 11 2 125 12 3 (blank) (blank) Grand Total 10 I need a macro to select the cells in the 2nd row (row just below the header) - only 3 columns and not the entire row - up to the row just before the row with (blank). How do I do that? Thanks, Dolphinv4 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to select different rows in Pivot table excel 2007 | Excel Discussion (Misc queries) | |||
Select Pivot Table | Excel Discussion (Misc queries) | |||
Field Select in a Pivot Table | Excel Discussion (Misc queries) | |||
Pivot Table help - select pages | Excel Discussion (Misc queries) | |||
Select all subtotal rows on Pivot Table | Excel Worksheet Functions |