Worksheet_Change Event, monitoring more than one cell

BenRichards

New Member
Joined
Apr 7, 2014
Messages
41
Hi,

I get the error "Object required," and debug highlights the bolded line. What is wrong with this bit of code?

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("T82:AA457")) Is Nothing And ActiveSheet.Range("V80").Value = "-" Then
Application.EnableEvents = False
ActiveSheet.Range("T82:AA457").Value = ""
Application.EnableEvents = True
End If

Thanks for your help!

End Sub
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
40,380
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Maybe it's the 'Thanks for your help!' before the End Sub. ;)
 
Upvote 0

BenRichards

New Member
Joined
Apr 7, 2014
Messages
41
VoG, encouraged by your comment I moved that bit of code from within a called macro to directly underneath the:

Private Sub Worksheet_Change(ByVal Target As Range)

And it works just fine. But if I put in Call Macro1 and insert the code into such a Macro, object required. Weird, but I think I can get along with this. Thanks.

RoryA, :LOL:
 
Upvote 0

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
40,380
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Did you pass Target to the macro? If not, you would get that error.
 
Upvote 0

Forum statistics

Threads
1,191,177
Messages
5,985,140
Members
439,942
Latest member
bkexcel11230

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
Top