MarkCBB
Active Member
- Joined
- Apr 12, 2010
- Messages
- 497
Hi there,
I need some code to bring up an msgbox on error:
Below is the section of code:
if the Name entered into the Inputbox does not match any of the items in the pivot table field I need a message box to appear, and the exit sub.
I need some code to bring up an msgbox on error:
Below is the section of code:
if the Name entered into the Inputbox does not match any of the items in the pivot table field I need a message box to appear, and the exit sub.
Code:
Range("C7") = InputBox("What Month would you like to extract? i.e. 2011/01/01 ", "Type in Month")
Set V_R = Range("C8")
Set Out_Name = Range("C6")
Set Month_Name = Range("C7")
With Sheets("List").PivotTables("PivotTable2").PivotFields("MONTH")
.PivotItems(Month_Name.Value).Visible = True
For Each Pi In .PivotItems
If Pi.Name <> Month_Name.Value Then Pi.Visible = False
Next Pi
End With