Saving ActiveCell coordinates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

I haven't performed any programming for years and I have a memory blank on
how to resolve this easy issue.

I need to save the current ActiveCell coordinates of the cursor so that I
can programmatically jump back to this cell at some later stage.

I need the code to save the current cell position and also the code to jump
back to this position. I know it involves copying the cell info to
variable(s) and using Range to jump but all my attempts have failed :(

Thanks

James
 
Hi
first: why are you 'jumping' around at all. Normally no need for select
statements in your code

For saving try:
sub foo()
dim oldcell as range
dim oldwks as worksheet

set oldwks=activesheet
set oldcell=activecell

'your code
oldwks.activate
oldcell.select
end sub
 
James

one way:

Sub SaveAndJump()
Dim ACAddress As String
MsgBox ActiveCell.Address
ACAddress = ActiveCell.Address
Range("AC1").Select
MsgBox ActiveCell.Address
Range(ACAddress).Select
MsgBox ActiveCell.Address
End Sub

Regards

Trevor
 
Sub ActCell()
Dim c
c = ActiveCell.Address
End Sub

Cheers... Mike F
 
A "simplistic" method (I'm simple!).

'Save the row/col values
r=activecell.Row
c=activecell.Column

'Go back
cells(r,c).select
 
Dim rng as Range

set rng = ActiveCell

.. . .

Application.Goto rng, true
 
James,

Try something like

Dim SaveRng As Range
Set SaveRng = ActiveCell
' your code here
SaveRng.Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top