Best Approach for this Worksheet_Change

Citanaf

New Member
Joined
Jun 30, 2014
Messages
10
Hello,

I have two ranges: N11:N510 and S11:S510 that can change (vlookups) based on a data validation list in Cell E8. Regardless of the value in E8, I only want the worksheet change to trigger if a value in N11:N510 or S11:S510 changed.

If the change macro determines that a change has occurred in N11:N510, I will have a UDF input in that same row in column AQ. We'll call it UDF()
If the change macro determines that a change has occurred in S11:S510, UDF() will be input in that same row in column AU.

I realize a worksheet_change event is triggered only by a user change and not a formula, so perhaps the worksheet_calculate event is more appropriate, but I haven't used it before and am unsure of how to approach it.

Bonus points if you add a line to copy/paste the value to remove the UDF().

Let me know if you need further clarity.

Thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
My approach to activate a macro on value change (works with formula):

For example C1=A1+B1 and macro would therefore run if A1 or B1 change with C1 in target

Code:
[TABLE="width: 588"]
<tbody>[TR]
[TD="class: xl63, width: 588"]Private  Sub Worksheet_Calculate()
    Static oldval
    If Range("C1").Value <> oldval Then
        oldval =  Range("C1").Value
        
        'rest of code here
        
        
    End If
    End Sub[/TD]
[/TR]
</tbody>[/TABLE]

I guess that If you start by

Dim TheCell as range
For each TheCell in Range("N11:N510")

Code

Next TheCell

You could get what you want
 
Upvote 0

Forum statistics

Threads
1,216,525
Messages
6,131,183
Members
449,630
Latest member
parkjun

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