Input box search by first letter of the cell value in the Column

fotodj

New Member
Joined
Jul 19, 2014
Messages
27
VBA Code:
Sub Button1_Click()


Application.ScreenUpdating = False
Sheets("Sheet1").Select

LR = Cells(Rows.Count, "A").End(xlUp).Row
st = InputBox("Type Keyword")
If st = "" Then Exit Sub
For j = LR To 1 Step -1
         code = Range("A" & j).Text
         If code = st Then
            
             Range("G" & j).Select
             Application.Goto ActiveCell.EntireRow, True
            
            Exit For
         End If
 Next

  Application.ScreenUpdating = True
End Sub

I will need help to modify this code which I wrote to search for the value in the column A and select that row. How can I search for the first cell in column with value starting with for example letter B or first word of the value in that cell ?
Putting B* ( or Bill*) in the input box does not work....
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
How about
VBA Code:
Sub Button1_Click()


Application.ScreenUpdating = False
Sheets("Sheet1").Select

LR = Cells(Rows.Count, "A").End(xlUp).Row
st = InputBox("Type Keyword")
If st = "" Then Exit Sub
For j = 1 To LR
         code = Range("A" & j).Text
         If code Like st Then
            
             Range("G" & j).Select
             Application.Goto ActiveCell.EntireRow, True
            
            Exit For
         End If
 Next

  Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top