I'm a beginner when it comes to Excel VBA and I'm completely lost.
I want the macro to partial match either "Buick", "Chevrolet", or "Pontiac". 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 but once I get this code working, I should be able to get code the rest.
Sub Extract_Data_Buick()
For Each cell In Sheets("SheetJS").Range("D1:D200")
matchrow = cell.Row
If (cell.Value = "*Buick*" Or cell.Value = "*Chevrolet*" Or cell.Value = "*Pontiac*") 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 (cell.Value = "*Buick*" Or cell.Value = "*Chevrolet*" Or cell.Value = "*Pontiac*") 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 (cell.Value = "*Buick*" Or cell.Value = "*Chevrolet*" Or cell.Value = "*Pontiac*") Then
Sheets("Sheet1").Range("AL" & matchrow).Value = cell.Value
End If
Next
End Sub
Any tips will be greatly appreciated!
Update 01.11.20
I have also tried but I still can't get the code to work.
Sub Extract_Data_Buick()
For Each cell In Sheets("SheetJS").Range("D1:D200")
matchrow = cell.Row
if (cell.value like "*Buick*") Or (cell.Value = "*Chevrolet*") Or (cell.Value = "*Pontiac*") 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 (cell.value like "*Buick*") Or (cell.Value = "*Chevrolet*") Or (cell.Value = "*Pontiac*") 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 (cell.value like "*Buick*") Or (cell.Value = "*Chevrolet*") Or (cell.Value = "*Pontiac*") Then
Sheets("Sheet1").Range("AL" & matchrow).Value = cell.Value
End If
Next
End Sub