ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,232
- Office Version
- 2007
- Platform
- Windows
Hi.
I am open to suggestion but i have this below at present to get me started.
I click on my command button & enter a value in the input field.
Example of input field value would be SHHCH1590XU201591
Now the code should look in column A4:A & advise me of the first nearest match.
Either MsgBox Your Nearest matc is at Row 55
Chances of the exact value being there is slim BUT possible hence nearest match.
If it is easier for you there is TextBox 1 on the worksheet & also a command button.
So maybe enter value in TextBox1 press command button & nearest match would turn that cell in column A red ??
I have the code so far in place but get a RTE 2004 each time so now stuck
I am open to suggestion but i have this below at present to get me started.
I click on my command button & enter a value in the input field.
Example of input field value would be SHHCH1590XU201591
Now the code should look in column A4:A & advise me of the first nearest match.
Either MsgBox Your Nearest matc is at Row 55
Chances of the exact value being there is slim BUT possible hence nearest match.
If it is easier for you there is TextBox 1 on the worksheet & also a command button.
So maybe enter value in TextBox1 press command button & nearest match would turn that cell in column A red ??
I have the code so far in place but get a RTE 2004 each time so now stuck
Rich (BB code):
Private Sub CommandButton1_Click()
Dim ans As String
Dim Fnd As Range
Do Until Not Fnd Is Nothing
ans = InputBox("Enter search for value")
If ans = "" Then Exit Sub
Set Fnd = Range("A4:A").Find(ans, , , xlPart, , , False, , False)
Loop
End Sub