ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find Command Button (https://www.excelbanter.com/excel-discussion-misc-queries/29443-find-command-button.html)

NeedMorHP

Find Command Button
 
I want to insert a Find Command Button in a spreadsheet so a user can click
on the button to go directly to a specific line.

thanks..

Ron de Bruin

Hi

Try this example for column A

This will select the first cell in column A with the InputBox value.

Sub Find_First()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Search value")
If Trim(FindString) < "" Then
Set Rng = Range("A:A").Find(What:=FindString, _
After:=Range("A" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"NeedMorHP" wrote in message ...
I want to insert a Find Command Button in a spreadsheet so a user can click
on the button to go directly to a specific line.

thanks..





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

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