ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Naming worksheets within a macro (https://www.excelbanter.com/excel-worksheet-functions/118708-naming-worksheets-within-macro.html)

GLS

Naming worksheets within a macro
 
Hi

I want to create a macro that copies data from an Access table to an Excel
worksheet, inserting a new worksheet each week, copying the data on to it and
naming it (the worksheet) with the date the data was copied. So I would have
a series of worksheets named 1 Nov 06, 8 Nov 06, 15 Nov 06 etc. Is there a
way I can get the macro to name each new worksheet sequentially like this?

Many thanks

GLS
--
GLS

Gary''s Student

Naming worksheets within a macro
 
Here is a start:

Sub Macro1()
Sheets.Add
ActiveSheet.Name = Application.WorksheetFunction.Text(Now, "dd mmm yy")
End Sub

This will insert a new sheet in the workbook and assign it today's date as
the tab name.
--
Gary's Student


"GLS" wrote:

Hi

I want to create a macro that copies data from an Access table to an Excel
worksheet, inserting a new worksheet each week, copying the data on to it and
naming it (the worksheet) with the date the data was copied. So I would have
a series of worksheets named 1 Nov 06, 8 Nov 06, 15 Nov 06 etc. Is there a
way I can get the macro to name each new worksheet sequentially like this?

Many thanks

GLS
--
GLS



All times are GMT +1. The time now is 10:28 PM.

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