Hi,
I have created this macro:
I always get a mismatch. The goal of the macro is to get from one sheet where are in column 2 are many many words like BAD, PROBLEM, STEVE, ROGER etc.. and only those with BAD and PROBLEM should transfer to the next sheet. The problem is that I get a mismatch in this line: If wsData.Cells(counter1, 2).Value = "Problem" OR wsData.Cells(counter1, 2).Value = "Bad".
The code is actually longer and it works for other parts in other columns where I used the command Like but when I try it for that column it does not work and I get a mismatch even when I use like for only one word example BAD.
I hope someone can help me.
Thank you for reading this and your time.
I have created this macro:
VBA Code:
Sub Macro
Dim wsData As Worksheet
Dim wsResult As Worksheet
Set wsData = ThisWorkbook.Worksheets("DATA")
Set wsResult = ThisWorkbook.Worksheets("Result")
counter1 = 2
If wsData.Cells(counter1, 2).Value = "Problem" OR wsData.Cells(counter1, 2).Value = "Bad" Then
wsSheet1.Cells(wsResult, 4).Value = "NOT"
End If
End Sub
I always get a mismatch. The goal of the macro is to get from one sheet where are in column 2 are many many words like BAD, PROBLEM, STEVE, ROGER etc.. and only those with BAD and PROBLEM should transfer to the next sheet. The problem is that I get a mismatch in this line: If wsData.Cells(counter1, 2).Value = "Problem" OR wsData.Cells(counter1, 2).Value = "Bad".
The code is actually longer and it works for other parts in other columns where I used the command Like but when I try it for that column it does not work and I get a mismatch even when I use like for only one word example BAD.
I hope someone can help me.
Thank you for reading this and your time.