ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving and returning to saved screen view? (Pan L/R U/D) (https://www.excelbanter.com/excel-programming/303544-saving-returning-saved-screen-view-pan-l-r-u-d.html)

Wandering Mage

Saving and returning to saved screen view? (Pan L/R U/D)
 
OK. So here's what I have. I click a cell, and a
selection change macro turns the cell value to "X" or ""
(toggles). Then it returns me to like range "B3", or
somewhere close to that. The problem is, part of where
this "X"ing macro is, may be far off to the right, and I
want the user to still be looking at where he clicked,
once the new value has been set to "X" or "", but I still
want the cell "B3" to be selected. Is there anyway to
save where the screen is panned over/up to before the
macro and then return it to that same view after? Help is
appreciated, as always! Thank you.

Nigel

Saving and returning to saved screen view? (Pan L/R U/D)
 
Try this. The first part stores the current cursor location (active cell),
your macro runs, then the last part takes you back to the stored location.
Is this what you need?

Dim cLoc As String
cLoc = ActiveCell.Address

'Your macro here that moves / scrolls the sheet to some other place

Application.Goto Reference:=Range(cLoc)


Cheers
Nigel


"Wandering Mage" wrote in message
...
OK. So here's what I have. I click a cell, and a
selection change macro turns the cell value to "X" or ""
(toggles). Then it returns me to like range "B3", or
somewhere close to that. The problem is, part of where
this "X"ing macro is, may be far off to the right, and I
want the user to still be looking at where he clicked,
once the new value has been set to "X" or "", but I still
want the cell "B3" to be selected. Is there anyway to
save where the screen is panned over/up to before the
macro and then return it to that same view after? Help is
appreciated, as always! Thank you.




Wandering Mage

Saving and returning to saved screen view? (Pan L/R U/D)
 
THANK YOU!
exactly what I was looking for.
-----Original Message-----
Try this. The first part stores the current cursor

location (active cell),
your macro runs, then the last part takes you back to the

stored location.
Is this what you need?

Dim cLoc As String
cLoc = ActiveCell.Address

'Your macro here that moves / scrolls the sheet to some

other place

Application.Goto Reference:=Range(cLoc)


Cheers
Nigel


"Wandering Mage"

wrote in message
...
OK. So here's what I have. I click a cell, and a
selection change macro turns the cell value to "X" or ""
(toggles). Then it returns me to like range "B3", or
somewhere close to that. The problem is, part of where
this "X"ing macro is, may be far off to the right, and I
want the user to still be looking at where he clicked,
once the new value has been set to "X" or "", but I

still
want the cell "B3" to be selected. Is there anyway to
save where the screen is panned over/up to before the
macro and then return it to that same view after? Help

is
appreciated, as always! Thank you.



.



All times are GMT +1. The time now is 05:07 AM.

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