![]() |
Set active sheet
How do you set the current worksheet as the activesheet so that when a
routine ends you are back to the worksheet you started in. |
Set active sheet
You are best off not to select sheets as you go but that takes a bit of
understanding how the excel objects model works... A quick way would be to add some code around your routine something like this... Sub DoSomeStuff dim wks as worksheet set wks = activesheet 'Do your stuff here... wks.select set wks = nothing end sub -- HTH... Jim Thomlinson "Patrick Simonds" wrote: How do you set the current worksheet as the activesheet so that when a routine ends you are back to the worksheet you started in. |
Set active sheet
Thanks for your time and reply, but I already using "Dim SH As Worksheet"
so it would not allow me to use "dim wks as worksheet" "Jim Thomlinson" wrote in message ... You are best off not to select sheets as you go but that takes a bit of understanding how the excel objects model works... A quick way would be to add some code around your routine something like this... Sub DoSomeStuff dim wks as worksheet set wks = activesheet 'Do your stuff here... wks.select set wks = nothing end sub -- HTH... Jim Thomlinson "Patrick Simonds" wrote: How do you set the current worksheet as the activesheet so that when a routine ends you are back to the worksheet you started in. |
All times are GMT +1. The time now is 10:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com