Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to select different rows in Pivot table excel 2007 Feejo Excel Discussion (Misc queries) 0 January 10th 08 12:35 AM
Select Pivot Table Wanna Learn Excel Discussion (Misc queries) 1 July 17th 07 08:01 PM
Field Select in a Pivot Table Vicki Excel Discussion (Misc queries) 2 May 12th 06 08:28 PM
Pivot Table help - select pages mjc Excel Discussion (Misc queries) 1 March 17th 06 03:40 PM
Select all subtotal rows on Pivot Table Marcotte A Excel Worksheet Functions 2 February 23rd 06 06:10 PM


All times are GMT +1. The time now is 02:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"