Compare to ranges function

ManUBlueJay

Active Member
Joined
Aug 30, 2012
Messages
326
Office Version
  1. 365
Platform
  1. Windows
I have 2 ranges, range1 and range 2. I would like to add code in the change section of a sheet if range1 no longer matches range 2.
I have tried this exel function but it never brings back a yes even if they are the same: =IF(AND(Range1=Range2), "Yes", "No")
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Does this do what you want??
VBA Code:
Sub test()
Set Range1 = Range("D3:F6")
Set Range2 = Range("D3:F6")
If (Range1.Address = Range2.Address) Then
tt = "Yes"
Else
tt = "No"
End If
MsgBox tt
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,224,829
Messages
6,181,222
Members
453,024
Latest member
Wingit77

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