If cell changes and is greater than

tintin1012000

Board Regular
Joined
Apr 27, 2011
Messages
237
Looking for help,

I have a whole number in A1 which has a whole number validation on it

I need a function that will monitor cell A10.
if A10 changes and then becomes a larger number than A1 then I need to change A1 to match A10

similarly if a user tries too input a figure into A1 which is lower than A10 then automatically change A1 to match A10

thanks all
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try

VBA Code:
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("A10")) Is Nothing Then
    If Range("A10").Value > Range("A1").Value Then
        Range("A1").Value = Range("A10").Value
    End If
End If
If Not Intersect(Target, Range("A1")) Is Nothing Then
    If Range("A10").Value > Range("A1").Value Then
        Range("A1").Value = Range("A10").Value
    End If
    
End If
End Sub
 
Upvote 0
Thanks so much for your help. it worked for me
T


Try

VBA Code:
  Private Sub Worksheet_Change(ByVal Target As Range)
  If Not Intersect(Target, Target.Worksheet.Range("A:O")) Is Nothing Then
  
    If Range("A10").Value > Range("A1").Value Then Range("A1").Value = Range("A10").Value
     End If
     
     If Not Intersect(Target, Range("A1")) Is Nothing Then
    If Range("A10").Value > Range("A1").Value Then Range("A1").Value = Range("A10").Value
    End If
     
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

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