Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Pivot Table - Hiding Rows

I have the following items:
1. A simplified database (DB) with 2 columns - column A:
Spare Parts ID (alphanumeric); column B: values. The DB
is the input to a Pivot Table (IDs to Row, values to
Data).

2. A macro that highlights all the items in the DB
(colorindex = 36) that have a specified ID. The
specified ID is obtained via an Inputbox.

3. A second macro hides all rows in the Pivot Table
except for a specified ID:

The second macro:

For Each p In ActiveSheet.PivotTables
("PivotTable1").PivotFields("SpareParts_ID").Pivot Items
p.Visible = (p.Name = myCell)
Next p

Where "myCell" is an ID of a spare part and is obtained
via another InputBox.

After highlighting the specified ID in the database
(first macro), how do I hide all rows in the Pivot Table
except for the IDs highlighted in the database? In short,
the variable "myCell" in the second macro needs to relate
to the highlighted ID (first macro).

TIA

Richard

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Pivot Table - Hiding Rows

For each cell in Range("DB").Columns(1).cells
if cell.Interior.ColorIndex = 36 Then
myCell = cell.Value
exit for
end if
Next
For Each p In ActiveSheet.PivotTables
("PivotTable1").PivotFields("SpareParts_ID").Pivot Items
p.Visible = (p.Name = myCell)
Next p

--
Regards,
Tom Ogilvy


"Richard" wrote in message
...
I have the following items:
1. A simplified database (DB) with 2 columns - column A:
Spare Parts ID (alphanumeric); column B: values. The DB
is the input to a Pivot Table (IDs to Row, values to
Data).

2. A macro that highlights all the items in the DB
(colorindex = 36) that have a specified ID. The
specified ID is obtained via an Inputbox.

3. A second macro hides all rows in the Pivot Table
except for a specified ID:

The second macro:

For Each p In ActiveSheet.PivotTables
("PivotTable1").PivotFields("SpareParts_ID").Pivot Items
p.Visible = (p.Name = myCell)
Next p

Where "myCell" is an ID of a spare part and is obtained
via another InputBox.

After highlighting the specified ID in the database
(first macro), how do I hide all rows in the Pivot Table
except for the IDs highlighted in the database? In short,
the variable "myCell" in the second macro needs to relate
to the highlighted ID (first macro).

TIA

Richard



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Pivot Table - Hiding Rows

Tom,

Thank you very much.

Regards,

Richard

-----Original Message-----
For each cell in Range("DB").Columns(1).cells
if cell.Interior.ColorIndex = 36 Then
myCell = cell.Value
exit for
end if
Next
For Each p In ActiveSheet.PivotTables
("PivotTable1").PivotFields("SpareParts_ID").Pivo tItems
p.Visible = (p.Name = myCell)
Next p

--
Regards,
Tom Ogilvy


"Richard" wrote in

message
...
I have the following items:
1. A simplified database (DB) with 2 columns - column

A:
Spare Parts ID (alphanumeric); column B: values. The DB
is the input to a Pivot Table (IDs to Row, values to
Data).

2. A macro that highlights all the items in the DB
(colorindex = 36) that have a specified ID. The
specified ID is obtained via an Inputbox.

3. A second macro hides all rows in the Pivot Table
except for a specified ID:

The second macro:

For Each p In ActiveSheet.PivotTables
("PivotTable1").PivotFields("SpareParts_ID").Pivot Items
p.Visible = (p.Name = myCell)
Next p

Where "myCell" is an ID of a spare part and is obtained
via another InputBox.

After highlighting the specified ID in the database
(first macro), how do I hide all rows in the Pivot

Table
except for the IDs highlighted in the database? In

short,
the variable "myCell" in the second macro needs to

relate
to the highlighted ID (first macro).

TIA

Richard



.

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
Pivot Table Hiding Totals = Zero Mnilo Excel Worksheet Functions 0 December 13th 08 05:05 PM
Pivot Table - Hiding Zero Values lcrean Excel Discussion (Misc queries) 2 September 3rd 08 12:21 PM
Hiding blank cells within a Pivot Table Shams Excel Worksheet Functions 1 July 12th 08 11:27 PM
Pivot Table hiding row removes from row ! Fullam Excel Discussion (Misc queries) 1 April 15th 06 12:44 AM
Hiding one subtotal in a pivot table MarkM Excel Discussion (Misc queries) 1 December 30th 05 09:30 AM


All times are GMT +1. The time now is 08:13 PM.

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

About Us

"It's about Microsoft Excel"