Excel vba find

  • Thread starter Thread starter chansing5
  • Start date Start date
C

chansing5

I want to quickly find all data in column A to finding range in column
B toW.
I set the loop in column A and use find method for range column B
toW , but it doesn't work.
Please find me out.

Here is my code:

Sub FinalMacro()

Dim i As Integer
Dim a As Variant

On Error Resume Next

For i = 5 To 30

Cells(i, 1).Offset(1, 0).Select

a = Cells(i, 1).Value

Sheets("HS").Range("B:W").Select

Selection.Find(What:="a", After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate

Next i

End sub
 
You don't need the quotes on this statement

Selection.Find(What:="a",

should be

Selection.Find(What:=a,
 
Back
Top