Macro to find a value in a worksheet
Closed
azmiismail
Posts
17
Registration date
Thursday March 3, 2011
Status
Member
Last seen
July 20, 2011
-
Mar 9, 2011 at 10:51 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 10, 2011 at 05:29 AM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 10, 2011 at 05:29 AM
Related:
- Macro to find a value in a worksheet
- Transfer data from one excel worksheet to another automatically - Guide
- Spell number in excel without macro - Guide
- Excel macro to create new sheet based on value in cells - Guide
- Macros in excel download - Download - Spreadsheets
- Automatically run a macro when opening a worksheet - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Mar 10, 2011 at 05:29 AM
Mar 10, 2011 at 05:29 AM
If you are new to macro, a very good starting point would be using macro recorder. It can give a general template for what you need.
Here is a macro that can do what you wanted
Here is a macro that can do what you wanted
Sub doExecuteSearch() Dim sSearchFor As String Dim rngCell As Range Do sSearchFor = InputBox("Please enter value to be searched", "Search") If sSearchFor <> vbNullString _ Then With Sheets("B2JT") Set rngCell = .Range("a2:a9").Find(sSearchFor, .Cells(8, 1), , xlWhole, xlByRows, xlNext) If Not rngCell Is Nothing _ Then MsgBox "found at row " & rngCell.Row & " and column " & rngCell.Column Else MsgBox "Not found" End If End With End If Loop While sSearchFor <> vbNullString End Sub