ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   switch to another worksheet, then return to original sheet (https://www.excelbanter.com/excel-programming/447059-switch-another-worksheet-then-return-original-sheet.html)

Tonso

switch to another worksheet, then return to original sheet
 
I have recorded a macro that daily copies a row of data on the current worksheet, then goes to a sheet named "data" and appends this data to a list. I want to have the macro return to the current sheet. However, I add a sheet every day and so the name of the current sheet is different every day. How can i accomplish this?

Thanks,

Tonso

Claus Busch

switch to another worksheet, then return to original sheet
 
Hi Tonso,

Am Thu, 6 Sep 2012 11:13:25 -0700 (PDT) schrieb Tonso:

I have recorded a macro that daily copies a row of data on the current worksheet, then goes to a sheet named "data" and appends this data to a list. I want to have the macro return to the current sheet. However, I add a sheet every day and so the name of the current sheet is different every day. How can i accomplish this?


first get the name of the current (active) sheet. Then run your code and
return to the current sheet:

shName = ActiveSheet.Name
'your code
Application.Goto Sheets(shName).Range("A1")


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Tonso

switch to another worksheet, then return to original sheet
 
On Thursday, September 6, 2012 2:13:26 PM UTC-4, Tonso wrote:
I have recorded a macro that daily copies a row of data on the current worksheet, then goes to a sheet named "data" and appends this data to a list. I want to have the macro return to the current sheet. However, I add a sheet every day and so the name of the current sheet is different every day. How can i accomplish this? Thanks, Tonso


Claus,
Thank you so very much!

Tonso


All times are GMT +1. The time now is 02:32 PM.

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