I am writing a small VBA program that needs to do two different things depending on if the first word of a string is "The" or "the". So far I have this but it is not matching them.
Sub Venues()
Dim masterFile As Workbook
Set masterFile = ActiveWorkbook
Dim venueSplitArray() As String
Dim tempString As String
venueSplitArray() = Split(masterFile.Sheets(Week).Cells(I, "E"))
tempString = venueSplitArray(0)
If StrComp(tempString = "The", 1) And StrComp(tempString = "the", 1) Then
''''''CODE'''''
Else
''''''CODE'''''
End If
End Sub
But this isnt working for me and always returns that the strings don't match.
StrComp(tempString = "The", 1), it should instead be:StrComp(tempString, "The", 1)(and you'll need to make the adjustment for bothStrCompcalls).Ifline should be or not and?1or set it to0so that it does a case sensitive comparison, and then leave out theAnd....portion of the IF statement.