Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default check if value exists in pivot table

I have a macro that inserts the value of the active cell into cell A1 of the
same worksheet. Pivot tables on other worksheets are then filtered by that
value. Now I need to write some error handling so that if the value of the
active cell is not contained in the pivot table, it exits the procedure.
Here is the code I have so far.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
If ActiveCell.Value = "" Then
Exit Sub
Else
'insert project name (value of column A of active row) into cell A1
Range("A1") = Cells(ActiveCell.Row, "A").Value
'insert staff name (value of column B of active row) into cell A2
Range("A2") = Cells(ActiveCell.Row, "B").Value

'refresh all pivot tables
ThisWorkbook.RefreshAll
End If
Application.ScreenUpdating = True
End Sub

Any help would be greatly appreciated.

- Mica
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 check Pivot Table source? Marcin Peciak New Users to Excel 2 January 25th 09 10:24 PM
If Pivot Table Exists, Delete on Close ryguy7272 Excel Programming 4 December 15th 08 12:10 PM
Determine If Pivot Table Exists ridawg Excel Programming 4 September 25th 06 08:55 PM
If Pivot Table Exists hoppermr Excel Programming 4 June 27th 06 05:47 PM
How can I use VBA ADO to check if a table exists in an Access DB? Ai_Jun_Zhang[_4_] Excel Programming 5 August 24th 05 07:52 PM


All times are GMT +1. The time now is 07:31 AM.

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"