Cell Address Help!

jjsauer

Board Regular
Joined
Jan 11, 2012
Messages
58
How can you obtain the cell address of the cell being used in a "For Each Cell in Range("A1:A10") VBA statement (For Next code)?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
How do I use cell.address?

I want to a.) us that to offset. Like cell.address.offset(0,1) = ABC
and b.) use that exact address on a different sheet, so if the cell happened to be A5, I want to set up in my macro to select A5 on sheet 2 for example.

Thanks!
 
Upvote 0
Thanks for the help, but I cannot figure this out...the line in red is where I am stuck

There is much more code, but this is the part that doesn't work. I have tried every variation I could think of.

For Each rCell In Range(Range1a, Range1b)
If rCell = "" Then
Else
With Workbooks("FY12-Q2 Data Tables.xlsx").Sheets("Total").Columns(1)
Set c = .Find("[" & rCell & "B" & "]", LookIn:=xlValues)
Set c = .Find(Cell.Offset(0, 1), After:=c)
Set c = .Find("Bottom 2 (NET)", After:=c)
End With
rCell.Offset(0, 14).Value = c.Offset(, 14).Value
rCell.Offset(0, 26).Value = c.Offset(, 3).Value
rCell.Offset(0, 27).Value = c.Offset(, 12).Value
rCell.Offset(0, 28).Value = c.Offset(, 15).Value
 
Upvote 0
so if the cell happened to be A5, I want to set up in my macro to select A5 on sheet 2 for example.

Thanks!

To offset the actual cell on the same sheet, do as Vaskov showed.

to use the same cell address on another sheet..do it this way

Sheets("Sheet2").Range(Cell.Address).Offset(0,1) = "ABC"
 
Upvote 0
I cannot believe it...I got it to work, but I swear I have tried this before.....

Set c = .Find(rCell.Offset(0, 1), After:=c)

Thanks for all the help, I will certainly use your advice for the multiple sheets thing.
 
Upvote 0

Forum statistics

Threads
1,216,175
Messages
6,129,310
Members
449,499
Latest member
HockeyBoi

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