Return Cell Location?

Thebatfink

Active Member
Joined
Apr 8, 2007
Messages
410
Hi,

I'm looping through a range in my sub basically looking for cells with none blank values and then using this value in the sub. Heres the code (the sheet to loop is obviously selected from a combobox)..

Code:
For Each myNumber In Sheets("" & comboboxday.Value & "").Range("H6:H52")
blah blah
Next myNumber

Now I have a requirement to use another cells value part way through the sub. It is always 10 cells to the right of the cell/row of myNumber which it is currently processing. I was hoping to just use offset to get to the cell value, but obviously myNumber is a cell value, not a location.

Is there anyway I can get at myNumber's cell location?

Thanks!
Batfink
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Why not have mynumber be the location and use mynumber.value where you need to know the value of the cell?
 
Upvote 0
You can use a range variable.

Code:
Dim oneCell as Range

For Each oneCell in Sheets("" & comboboxday.Value & "").Range("H6:H52").Cells
    With oneCell
        MsgBox "The value 10 columns right of " & .Address & " is " & .Offset(0, 10).Value

        Rem do stuff
    End With
Next oneCell
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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