Need Help Matching a variable and defining as a range

egraham3

Board Regular
Joined
Jun 14, 2010
Messages
200
I'd like to have a variable. find it in column of data, and then define the value that is Offset(0,1) as a range.

i thought i had it, but couldnt quite get the code right. I need this for VBA.
 
so my the value im looking for is 2.56736E-03

and the values im sifting through are 5.787E-05 apart.

what do you suggest?
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
nvm, looks like its not the rounding, its not returning a .value for me?
hmmm.

im rounding to 5 places
 
Upvote 0
Try

Code:
Sub test()
Dim x As Variant, Found As Range, LR As Long, i As Long
x = 0.00256736
LR = Range("H" & Rows.Count).End(xlUp).Row
For i = 2 To LR
    With Range("H" & i)
        If Round(.Value, 5) = Round(x, 5) Then
            Set Found = .Offset(1)
            Exit For
        End If
    End With
Next i
If Not Found Is Nothing Then MsgBox Found.Address
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,665
Members
449,462
Latest member
Chislobog

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