ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel vba find (https://www.excelbanter.com/excel-programming/390187-excel-vba-find.html)

[email protected]

Excel vba find
 
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


joel

Excel vba find
 
You don't need the quotes on this statement

Selection.Find(What:="a",

should be

Selection.Find(What:=a,

" wrote:

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




All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com