Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Increment sheet names

I need to add a new sheet to a file every week; that new
sheet name becomes Wk 39, the previous sheet was Wk 38,
for all 52 weeks. Is there a way to automatically label
the new sheet to the new week number? I've been trying to
come up with code to do this for awhile, but I'll admit
defeat at this point. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Increment sheet names

Try this

Worksheets.Add.Name = "Wk " & weeknum(Now)

You must check the Analysis toolpack VBA add-in
ToolsAdd-ins in Excel

And in the VBA editor
Tools References, and put a check next to "ATPVBAEN.xls" workbook in the
references list.


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Eva Shanley" wrote in message ...
I need to add a new sheet to a file every week; that new
sheet name becomes Wk 39, the previous sheet was Wk 38,
for all 52 weeks. Is there a way to automatically label
the new sheet to the new week number? I've been trying to
come up with code to do this for awhile, but I'll admit
defeat at this point. Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Increment sheet names

Ron, thanks for the answer! The only problem is I didn't
think to mention our Wk 1 goes by fiscal year instead of
calendar year. My Wk 1 is actually the week starting
Sat., February 8, 2003. I can modify the code to subtract
a set number of days to get the right week, but that
obviously causes problems for the user if they don't run
this within a certain time period.

-----Original Message-----
Try this

Worksheets.Add.Name = "Wk " & weeknum(Now)

You must check the Analysis toolpack VBA add-in
ToolsAdd-ins in Excel

And in the VBA editor
Tools References, and put a check next

to "ATPVBAEN.xls" workbook in the
references list.


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Eva Shanley" wrote

in message ...
I need to add a new sheet to a file every week; that new
sheet name becomes Wk 39, the previous sheet was Wk 38,
for all 52 weeks. Is there a way to automatically label
the new sheet to the new week number? I've been trying

to
come up with code to do this for awhile, but I'll admit
defeat at this point. Thanks!



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Increment sheet names

Hi Eva

You can also count the sheets and add one or more if you have other sheets in the workbook also

Worksheets.Add.Name = "Wk " & ThisWorkbook.Sheets.Count + 1


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Eva Shanley" wrote in message ...
Ron, thanks for the answer! The only problem is I didn't
think to mention our Wk 1 goes by fiscal year instead of
calendar year. My Wk 1 is actually the week starting
Sat., February 8, 2003. I can modify the code to subtract
a set number of days to get the right week, but that
obviously causes problems for the user if they don't run
this within a certain time period.

-----Original Message-----
Try this

Worksheets.Add.Name = "Wk " & weeknum(Now)

You must check the Analysis toolpack VBA add-in
ToolsAdd-ins in Excel

And in the VBA editor
Tools References, and put a check next

to "ATPVBAEN.xls" workbook in the
references list.


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Eva Shanley" wrote

in message ...
I need to add a new sheet to a file every week; that new
sheet name becomes Wk 39, the previous sheet was Wk 38,
for all 52 weeks. Is there a way to automatically label
the new sheet to the new week number? I've been trying

to
come up with code to do this for awhile, but I'll admit
defeat at this point. Thanks!



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Increment sheet names

Ron, I can't thank you enough because I'll use this in a
lot of spreadsheets; it's exactly what I needed. I tried
to come up with this myself before I asked here, but it
always seems like I'm "close but no cigar". But, each time
someone is nice enough to help me out I learn a little
more. Thanks again.

-----Original Message-----
Hi Eva

You can also count the sheets and add one or more if you

have other sheets in the workbook also

Worksheets.Add.Name = "Wk " & ThisWorkbook.Sheets.Count +

1


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Eva Shanley" wrote

in message ...
Ron, thanks for the answer! The only problem is I

didn't
think to mention our Wk 1 goes by fiscal year instead of
calendar year. My Wk 1 is actually the week starting
Sat., February 8, 2003. I can modify the code to

subtract
a set number of days to get the right week, but that
obviously causes problems for the user if they don't run
this within a certain time period.

-----Original Message-----
Try this

Worksheets.Add.Name = "Wk " & weeknum(Now)

You must check the Analysis toolpack VBA add-in
ToolsAdd-ins in Excel

And in the VBA editor
Tools References, and put a check next

to "ATPVBAEN.xls" workbook in the
references list.


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Eva Shanley"

wrote
in message news:024801c39f25$a573c560

...
I need to add a new sheet to a file every week; that

new
sheet name becomes Wk 39, the previous sheet was Wk

38,
for all 52 weeks. Is there a way to automatically

label
the new sheet to the new week number? I've been

trying
to
come up with code to do this for awhile, but I'll

admit
defeat at this point. Thanks!


.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy formula - keep cell same but increment sheet numbers Ali Excel Discussion (Misc queries) 6 April 21st 23 10:11 PM
Linked Cells, Increment Sheet Number Ref. CVinje Excel Discussion (Misc queries) 3 August 23rd 09 05:30 AM
change formula- keep cell increment sheet numbers Ali Excel Discussion (Misc queries) 3 March 24th 09 09:31 AM
Formula copy paste down in a sheet but change row letter increment Mike Excel Discussion (Misc queries) 13 December 15th 08 05:35 PM
Automatic cell increment with data from sheet 1 to sheet 2 Big G Excel Worksheet Functions 2 December 20th 04 05:59 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"