The below function always evaluates as False even when I compare a cell to itself.
In addition, I wanted to be able to pull in all the strings as an array to make this easier manage, but I couldn't figure out how, so I had to use 20 seperate string variables.
If you could shed any light on that, it would be helpful.
My goal is to have a formula that will look at n number of different values and return TRUE if they are all exactly the same or False if any one of the values are different.
In addition, I wanted to be able to pull in all the strings as an array to make this easier manage, but I couldn't figure out how, so I had to use 20 seperate string variables.
My goal is to have a formula that will look at n number of different values and return TRUE if they are all exactly the same or False if any one of the values are different.
Function CompareText(sText1 As String, sText2 As String, Optional sText3 As String, Optional sText4 As String, _
Optional sText5 As String, Optional sText6 As String, Optional sText7 As String, Optional sText8 As String, _
Optional sText9 As String, Optional sText10 As String, Optional sText11 As String, Optional sText12 As String, _
Optional sText13 As String, Optional sText14 As String, Optional sText15 As String, Optional sText16 As String, _
Optional sText17 As String, Optional sText18 As String, Optional sText19 As String, Optional sText20 As String) _
As Boolean
Dim iCount As Integer
iCount = 2
While "sText" & iCount <> Empty
If sText1 <> "sText" & iCount Then
CompareText = False
Exit Function
End If
iCount = iCount + 1
Wend
CompareText = True
End Function