I keep getting a 1004 error - im really trying to get my head round VBA and ive got a lot of this down! I recorded the macro and then edited it adding the user input box and wild card temrms which im sure would be;
"*" & search & "*"
My goal is to have the macro open the user input box when sheet SP is opened. Then search sheet "product table" for the user input. Copy the cell contents, and paste to cell in "SP"
My ultimate goal is to then search every other coloumn for the same string and copy to the bottom of the table ( the next empty row ) - But i would like to try and give this a go myself.
I am stuck on this
Range("A1:I500").Select
this is where i get the error 1004
below is my script
Private Sub Worksheet_Activate()
'do input box
Dim search
search = InputBox("What are you searching for?")
'delete old data
Application.ScreenUpdating = False
Range("B7:I500").Select
'do autofilter
Sheets("Product Table").Select
Range("A1:I500").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$I$809").AutoFilter Field:=1, Criteria1:="*" & search & "*", _
Operator:=xlAnd
Columns("A:I").Select
Range("I1").Activate
Selection.Copy
ActiveSheet.Range("$A$1:$I$809").AutoFilter Field:=1
Sheets("SP").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("F16").Select
Application.ScreenUpdating = True
End Sub
Does anyone have an idea why this is happening?