Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Search a value in column © row...[Excel VBA]
- http://pastebin.com/di3tdZEJ
- [Q&A] search macro in excel using VB
- http://pastebin.com/KrnQLT5Y
- ---------------------------------------------------------------
- [Tutorial] Find Excel (Macro)
- Syntax :
- Cells.Find(What:="Cat", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
- xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
- , SearchFormat:=False).Activate
- '--Sample 1:
- '--Sub FindCatOtherSheet()
- Dim rFound As Range
- On Error Resume Next
- With Sheet1
- Set rFound = .Columns(1).Find(What:="Cat", After:=.Cells(1, 1), LookIn:=xlValues, LookAt:= _
- xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
- , SearchFormat:=False)
- On Error GoTo 0
- If Not rFound Is Nothing Then Application.Goto rFound, True
- End With
- End Sub
- '--Sample 2:
- '--Sub Find_Bold_Cat()
- Dim lCount As Long
- Dim rFoundCell As Range
- Set rFoundCell = Range("A1")
- For lCount = 1 To WorksheetFunction.CountIf(Columns(1), "Cat")
- Set rFoundCell = Columns(1).Find(What:="Cat", After:=rFoundCell, _
- LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
- SearchDirection:=xlNext, MatchCase:=False)
- With rFoundCell
- .ClearComments
- .AddComment Text:="Cat lives here"
- End With
- Next lCount
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement