I'm a beginner.
I want the macro to partial match "Buick", "Chevrolet", or "Pontiac" in each column. There will only be one match per Column, if any.
- The matches in Column D "SheetJS" should be copied to Column AA in "Sheet1".
- The matches in Column E "SheetJS" should be copied to Column AH in "Sheet1".
- The matches in Column F ("SheetJS") should be copied to Column AL in "Sheet1".
I have other ranges and other words to match but if can get this code working, I should be able to code the remaining things.
I keep getting an error message:
Compile Error: Expected: Then or GoTo
I don't know how to fix this issue.
Sub Extract_Data_Buick2()
For Each cell In Sheets("SheetJS").Range("D1:D200")
matchrow = cell.Row
If instr ("*Buick*", cell.value)> 0 Or_
instr ("*Chevrolet*", cell.value)> 0 Or_
instr ("*Pontiac*", cell.value)> 0 Or_ Then
Sheets("Sheet1").Range("AA" & matchrow).Value = cell.Value
End If
Next
For Each cell In Sheets("SheetJS").Range("E1:E200")
matchrow = cell.Row
If instr ("*Buick*", cell.value)> 0 Or_
instr ("*Chevrolet*", cell.value)> 0 Or_
instr ("*Pontiac*", cell.value)> 0 Or_ Then
Sheets("Sheet1").Range("AH" & matchrow).Value = cell.Value
End If
Next
For Each cell In Sheets("SheetJS").Range("F1:F200")
matchrow = cell.Row
If instr ("*Buick*", cell.value)> 0 Or_
instr ("*Chevrolet*", cell.value)> 0 Or_
instr ("*Pontiac*", cell.value)> 0 Or_ Then
Sheets("Sheet1").Range("AL" & matchrow).Value = cell.Value
End If
Next
End Sub