ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Return to active cell (https://www.excelbanter.com/excel-discussion-misc-queries/146810-return-active-cell.html)

Alex.W

Return to active cell
 
I am working with two sheets in the same workbook. I move between the two
sheets using active buttons with assigned macros. How do I get the macro in
the second sheet to return to the active cell in the first sheet?

Many thanks
Alex.W

FSt1

Return to active cell
 
hi,
add code like this or similar in the macro
sub mac1()
dim sh as worksheet
dim rng as range
set sh = activeworksheet 'remember this sheet
set rng = activecell 'remember this cell
Sheets("sheet2").Activate
'do macro stuff
sh.Activate 'return to previouse active sheet
rng.Select 'return to previouse active cell
End Sub

regards
FSt1

"Alex.W" wrote:

I am working with two sheets in the same workbook. I move between the two
sheets using active buttons with assigned macros. How do I get the macro in
the second sheet to return to the active cell in the first sheet?

Many thanks
Alex.W


Alex.W

Return to active cell
 
Thanks very much, it certainly helped.
Alex.W

"FSt1" wrote:

hi,
add code like this or similar in the macro
sub mac1()
dim sh as worksheet
dim rng as range
set sh = activeworksheet 'remember this sheet
set rng = activecell 'remember this cell
Sheets("sheet2").Activate
'do macro stuff
sh.Activate 'return to previouse active sheet
rng.Select 'return to previouse active cell
End Sub

regards
FSt1

"Alex.W" wrote:

I am working with two sheets in the same workbook. I move between the two
sheets using active buttons with assigned macros. How do I get the macro in
the second sheet to return to the active cell in the first sheet?

Many thanks
Alex.W



All times are GMT +1. The time now is 09:11 AM.

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