MrExcel Publishing
Your One Stop for Excel Tips & Solutions

how to reference a sheet using a variable

Posted by Sid Taylor on September 10, 2001 1:47 PM

I am trying to save data everyday to a sheet named that day, ie sept9. I need to use a variable to pull up whatever days info I need for my spreadsheet. Any ideas?

Posted by Russell Hauf on September 10, 2001 4:26 PM

Can you be more specific? It's hard to tell what you want to do here. If you want to name a sheet like today's date, you could do something like:

Sheets("newSheet").Name = Year(Date) & Month(Date) & Day(Date)

This would name the sheet "20010910" if it was used today (Date gives your system date).

If you wanted to use "Sep", I think you could do this:

Sheets("newSheet").Name = Format(Date, "mmm") & Day(Date)

(result would be "Sep10")

-Hope this helps,