My second error handler doesn't work. I am getting a Run-time error from the line after "On Error GoTo Error_Handler_2" in this macro:
Sub Macro1()
If Sheets("Sheet5").PivotTables("PivotTable2").PivotFields("Type").PivotItems("a").Position = 1 Then x = "a"
On Error GoTo Error_Handler
If Sheets("Sheet5").PivotTables("PivotTable2").PivotFields("Type").PivotItems("e").Position = 2 Then x = "e"
Exit Sub
Error_Handler:
On Error GoTo Error_Handler_2
If Sheets("Sheet5").PivotTables("PivotTable2").PivotFields("Type").PivotItems("f").Position = 1 Then x = "f"
Error_Handler_2:
MsgBox "Unsolvable Error"
End Sub
I thought that a second "On Eror GoTo" would work within the first "On Eror GoTo" This is for a Pivot table that only has fields "a", "b" and "c", no "e" or "f" fields. Any thoughts would be greatly appreciated.
Sub Macro1()
If Sheets("Sheet5").PivotTables("PivotTable2").PivotFields("Type").PivotItems("a").Position = 1 Then x = "a"
On Error GoTo Error_Handler
If Sheets("Sheet5").PivotTables("PivotTable2").PivotFields("Type").PivotItems("e").Position = 2 Then x = "e"
Exit Sub
Error_Handler:
On Error GoTo Error_Handler_2
If Sheets("Sheet5").PivotTables("PivotTable2").PivotFields("Type").PivotItems("f").Position = 1 Then x = "f"
Error_Handler_2:
MsgBox "Unsolvable Error"
End Sub
I thought that a second "On Eror GoTo" would work within the first "On Eror GoTo" This is for a Pivot table that only has fields "a", "b" and "c", no "e" or "f" fields. Any thoughts would be greatly appreciated.