Method Intersect of Object _Global Failed

CarlosQ

New Member
Joined
Jan 15, 2019
Messages
2
I don't have a lot of experience with VBA and there's one error that keeps bugging me. The following code does exactly what I want, with the exception that I get the "Method Intersect of Object _Global Failed" error every time I update cell B3. What am I doing wrong? I thought I was being specific on the worksheet to avoid this issue. I've tried changing the Worksheets from (1) to the actual name of the sheet ("Principal") with no luck.

The bold section is what's being highlighted in yellow when I try to debug.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Intersect(Target, Worksheets(1).Range("B3:B4")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Dim Field As PivotField
Dim NewCat As String
Set pt = Worksheets(1).PivotTables("PivotTable4")
Set Field = pt.PivotFields("Paciente")
NewCat = Worksheets(1).Range("B3").Value
With pt
Field.ClearAllFilters
Field.CurrentPage = NewCat
pt.RefreshTable
End With




End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I would like to add, I get that error when I modify any cell, on any worksheet, in that specific file.
 
Upvote 0

Forum statistics

Threads
1,216,086
Messages
6,128,734
Members
449,466
Latest member
Peter Juhnke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top