Welcome to FreeSoftwareServers Confluence Wiki


Note: My Function is much simpler, but served my purpose, in the SO post there is another longer/SLOWER function that will check cell contents.

Public Function RangeLengthsEqualBoolean(rngA As Range, rngB As Range) As Boolean
If rngA.Cells.Count = rngB.Cells.Count Then
 Debug.Print "Ranges are Equal"
 RangeLengthsEqualBoolean = True
 Debug.Print "Ranges are NOT Equal"
 RangeLengthsEqualBoolean = False
End If
End Function
Public Sub Testings()

Dim rngA As Range, rngB As Range

Set rngA = Range("A1:A10")
Set rngB = Range("A1:A10")
'Set rngB = Range("A2:A10")

Dim RangeComparision As Boolean
RangeComparison = RangeLengthsEqualBoolean(rngA, rngB)
Debug.Print RangeComparison

End Sub
  • No labels