Remember (w/variables) the Active Cell, how to?

TTom

Well-known Member
Joined
Jan 19, 2005
Messages
518
I need to rember an active cell so I can get to it later.
Below is a test marco that needs some help. Thanks,
TTom
****
Sub RememberActive()
Dim r As Integer, c As Integer

Sheets("MySheet").Activate
Range("B4").Select

'Since "B4" is the active cell record the it's row and column
'as r and c. thus r=4 and c=2. This will be used later to
'return to via: Cells(r,c).Select I will know the sheet name.

End Sub
****
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi TTom,
If I understand...try:

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> RememberActive()
<SPAN style="color:#00007F">Dim</SPAN> r <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, c <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
Sheets("MySheet").Activate
Range("B4").Select
r = ActiveCell.Row
c = ActiveCell.Column
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Sometimes it's the simple stuff that plum evades us. (At least me anyway! :LOL: )

Hope it helps,
Dan
 
Upvote 0
Dan's the Man!
Right, sometime brain fog clouds the obvious...
Thanks, Tom
 
Upvote 0
Can also --

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> foo()
<SPAN style="color:#00007F">Dim</SPAN> ActAdr
ActAdr = ActiveCell.Address
[x5].Select
MsgBox ActAdr
Range(ActAdr).Select
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0

Forum statistics

Threads
1,206,811
Messages
6,074,998
Members
446,112
Latest member
nmz1133

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