Ok here is my problem, I have completed a search for wildcards in my macro and now want to use this wildcard variable to pick out any cells containing anything similar
by that I mean the first few letters match
wildcard = dav
therefore will pick out david, dave or davina in my worksheet
her is my code so far
C = the wildcard
Sub Transfer_data(C)
If Not C = "" Then
Index2 = 1
Sheets("main"
Sheets(C).Select
Range("A2"
Sheets("main"
Columns(2).Select
Do While Cells(Index2, 1) <> ""
If Cells(Index2, 2) = (C) Then
Rows(Index2).Select
Selection.Copy
ActiveSheet.Select
Sheets(C).Select
ActiveSheet.Paste
ActiveCell.Offset(1, 0).Select
Sheets("main"
End If
Index2 = Index2 + 1
Loop
Else: End If
End Sub 'Transfer_data
The problem comes with the if statement being too precise. I thought about a 'LIKE' stament
dim LIKEA
MYLIKE = C LIKE ACTIVECELL.VALUE
But this doesnt work.
The main problem is that I the code works fine when not doing a wildcard search but specifying the variable exactly so I dont want to change it so that it stops doing these searches properly
Any ideas?
Andrew299