Trigger Macro when Cell>Another Cell

brumby

Active Member
Joined
Apr 1, 2003
Messages
400
Hiya all,

I am trying to trigger a macro as soon as a cell in a range becomes greater than a corresponding cell within another range, eg below

Range k:K is the "original" range, this is what the cells within AU:AU are comparing to,

As soon as a cell in range AU:AU is >= the same cell in K:K copy and paste AU:AU as value into K:K see below example on k15 & au15

K15 = 100 & AU15 = 75 - do nothing
k15 = 100 & AU15 = 99 - do nothing
k15 = 100 & AU15 = 100 - make k:K = au:au as hard value.


Is this possible?

Many Thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
How does the cell in Au change ??
Is it by formula, manual input ??
 
Upvote 0
So do you manually imput the precedent cell that triggers the formula ??

Try this in the sheet module

Code:
Sub worksheet_calculate()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "K").End(xlUp).Row
For r = 1 To lr
If Range("AU" & r).Value >= Range("K" & r).Value Then
    Range("K1:K" & lr).Value = Range("AU" & r).Value
End If
Next r
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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