PDA

View Full Version : [SOLVED] Find Value?



Radka
11-10-2004, 02:31 AM
I have data in Column B of my worksheet. And I have a value "VS", which is in range of ColumnB data. I have to find between which cell's values is my "VS" and the number of these cells(B10 and B11 and s.o).
For example, my value is VS=0,52. Range of data in ColumnB is from 0,49 to 0,56(increasing linear function) and ColumnB consists 100 cells. Maybe my value is between cells B16 and B17, or between B45 and B46. I have to find where exactly is my value VS?
Can anybody help me? Thanks in advance!

Jacob Hilderbrand
11-10-2004, 03:35 AM
Try this:


Option Explicit

Sub FindValue()
Dim Value As Double
Dim LastRow As Long
Dim i As Long
Value = InputBox("What is the search value?")
LastRow = Range("B65536").End(xlUp).Row
For i = 1 To LastRow
If Range("B" & i + 1).Value > Value Then
MsgBox "The Range is B" & i & ":B" & i + 1
Exit For
End If
Next i
End Sub

Rady
11-10-2004, 07:58 AM
Thanks a lot! I have made some specific for me changes and this works exellent.
Thank you!

Jacob Hilderbrand
11-10-2004, 08:31 AM
You're Welcome

Take Care