Excel Macros for Worksheet tabs

coachme

New Member
Joined
Jan 2, 2003
Messages
2
I have a client that runs a transportation company. They create a printed reservations manual and they use excel to do it. They use the worksheet tabs as days and dates of the week. Is there a macro or something that will automatically put the date on the page so they won't have to type it in? You can't do this on the tabs manually? You can't simply use the header/footer function because when you put in the date selector it only changes when the date actually changes and they want to print the books up to a year in advance (that's how far in advance they accept reservations).
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Range("$A$1").Value = ActiveSheet.Name will place the name of a sheet in A1. You will need to decide how you want to trigger the macro. You may need to loop or use an Event procedure depending on how they wish to do it.

HTH
This message was edited by lenze on 2003-01-03 17:27
 
Upvote 0
coachme,

Try this:

<pre>
Sub CreateOrderSheets()
Application.ScreenUpdating = False
StartDate = 37621

For i = 1 To 365
DoW = Application.WorksheetFunction.WeekDay(StartDate + i, 2)

If DoW <> 6 And DoW <> 7 Then
ActiveSheet.Name = Format(StartDate + i, "d-mmm-yy")
PreviousSheet = ActiveSheet.Name
ActiveSheet.Copy After:=Sheets(PreviousSheet)
End If
Next i

Application.ScreenUpdating = True
End Sub
</pre>

I've assumed the following:

1) Your client has a workbook containing one sheet that they use as a template. This workbook needs to be the open, active workbook when this routine is run.

2) They don't take orders on weekends.


Give it a try and see if it does what you want.

Also, I've hard coded in the the serial number for 12/31/02. That will either need to be changed for next year or an input box needs to be added to prompt the user to put in the "StartDate".


have fun
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top