Return to active cell

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

Guest

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
 
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
 
Thanks very much, it certainly helped.
Alex.W

FSt1 said:
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
 
Back
Top