Worksheet_Change named range problem

Arty Choke

New Member
Joined
Oct 7, 2009
Messages
9
I have a spreadsheet that runs a macro when a change happens within either of two named ranges. The original code is as follows:




Private Sub Worksheet_Change(ByVal Target As Range)
'Check to see that we have enabled auto macro updating
If Range("Report_Type_Auto_Run_Macros") = "ENABLED" Then
'Remember which cell I started on, so I can return there
Starting_Cell = ActiveCell.Address
'Turn off ALL events so the sub does not put the code into a loop.
Application.EnableEvents = False
'Hide and Unhide Rows - Did we change something warranting a Row Hide / Unhide update?
'**********
If Not Intersect(Target, Range("Report_Type_Row_Flags", "Report_Type_Selected")) Is Nothing Then
Call Hide_and_Unhide_Rows_and_Columns
End If
'Turn on ALL events
Application.EnableEvents = True
'Return to the cell I started on
Range(Starting_Cell).Select
End If
End Sub



I noticed that the macro was being called by changes in cells other than just those in the named ranges. I believe that I made an error in the line following "'**********". I had enclosed each of the named ranged in seperate quotes, and should have grouped them within the same quotes. I changed the line to read as follows:

If Not Intersect(Target, Range("Report_Type_Row_Flags, Report_Type_Selected")

It is no longer triggered by the wrong cells, but it also no longers reacts to cell value changes in the named range "Report_Type_Row_Flags" unless I type in a new value. It used to react any time the formulas in these cells caused any of them to change value. The other named range is a data validation list, and works fine.

How do I make the Worksheet_Change react to cell value changes caused by formulas?

Thanks!
Arty
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

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