I'm just beginning but I'm not sure why the following code is wrong:
Sub Macro1()
For i = 1 To Worksheets(1).Columns.Count
If InStr(Worksheets(1).Range("G6").Offset(0, i), Worksheets(2).Range("C3")) > 0 Then
If InStr(Worksheets(1).Range("G6").Offset(0, i), Worksheets(2).Range("D3")) > 0 And InStr(Worksheets(2).Range("G6").Offset(0, i), Worksheets(2).Range("E3")) > 0 Then
Worksheets(1).Range("G:G").Offset(0, i).Copy
Worksheets(3).Range("A1").Select
ActiveCell.Paste
End If
End If
Next i
End Sub
I get an application-oriented or object-oriented error in the first instr line:
If InStr(Worksheets(1).Range("G6").Offset(0, i), Worksheets(2).Range("C3")) > 0
I don't know why???
Sub Macro1()
For i = 1 To Worksheets(1).Columns.Count
If InStr(Worksheets(1).Range("G6").Offset(0, i), Worksheets(2).Range("C3")) > 0 Then
If InStr(Worksheets(1).Range("G6").Offset(0, i), Worksheets(2).Range("D3")) > 0 And InStr(Worksheets(2).Range("G6").Offset(0, i), Worksheets(2).Range("E3")) > 0 Then
Worksheets(1).Range("G:G").Offset(0, i).Copy
Worksheets(3).Range("A1").Select
ActiveCell.Paste
End If
End If
Next i
End Sub
I get an application-oriented or object-oriented error in the first instr line:
If InStr(Worksheets(1).Range("G6").Offset(0, i), Worksheets(2).Range("C3")) > 0
I don't know why???