switch to another worksheet, then return to original sheet

T

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. Iwant to have the macro return to the current sheet. However, I add a sheetevery day and so the name of the current sheet is different every day. Howcan i accomplish this?

Thanks,

Tonso
 
C

Claus Busch

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
 
T

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? Thanks, Tonso

Claus,
Thank you so very much!

Tonso
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top