ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving ActiveCell coordinates (https://www.excelbanter.com/excel-programming/314551-saving-activecell-coordinates.html)

James Duncan

Saving ActiveCell coordinates
 
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


Frank Kabel

Saving ActiveCell coordinates
 
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

--
Regards
Frank Kabel
Frankfurt, Germany

"James Duncan" <James schrieb im
Newsbeitrag ...
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



Trevor Shuttleworth

Saving ActiveCell coordinates
 
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


"James Duncan" <James wrote in message
...
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




Mike Fogleman

Saving ActiveCell coordinates
 
Sub ActCell()
Dim c
c = ActiveCell.Address
End Sub

Cheers... Mike F
"James Duncan" <James wrote in message
...
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




RWN

Saving ActiveCell coordinates
 
A "simplistic" method (I'm simple!).

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

'Go back
cells(r,c).select


--
Regards;
Rob
------------------------------------------------------------------------
"James Duncan" <James wrote in message
...
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




Tom Ogilvy

Saving ActiveCell coordinates
 
Dim rng as Range

set rng = ActiveCell

.. . .

Application.Goto rng, true

--
Regards,
Tom Ogilvy


"James Duncan" <James wrote in message
...
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




Chip Pearson

Saving ActiveCell coordinates
 
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





"James Duncan" <James wrote in
message
...
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





All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com