Hello Community
I have been pulling my hair out with an Excel VBA problem which I was hoping someone could help me with.
I have the following data:-
excelllll.JPG
Hoping you can see the data. If you cannot I have in
Row 2, Column A = [1100 2100 3601] Text3020 Work
Row 2, Column B = YES or NO
Row 2, Column C = DOWN SLOW 2100 UP SLOW 3601 UP MAIN 1100
What I am trying to do is take the text in the square brackets in row 2 column A [1100 2100 3601]
And then check if ALL of these values are contained in Row 2 Column C
If Row 2 Column C does contain all of the values in the square brackets from row 2 column A then Row 2 Column B is YES, otherwise it is no.
I want I repeat this until I have checked all rows in column A
The bits of code I have found so far include:-
Dim sCellVal As String
sCellVal = Range("B2").Value
If sCellVal Like "1100 2100 3601" Then
Cells(1, 1) = "YES"
Else
Cells(1, 1) = "NO"
End If
End Sub
Sub sadfsa()
A = 1100
B = 2100
C = 3601
Dim celltxt As String
celltxt = ActiveSheet.Range("B2").Text
If InStr(celltxt, A) And InStr(celltxt, B) And InStr(celltxt, C) Then
MsgBox ("found it")
Else
MsgBox ("no")
End If
End Sub
But none of the above works.
Can anyone help please?
I am using Excel 2003
I am using excel 2003
Bookmarks