Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Opening a Worksheet Dependant on Date

I am creating a work management schedule for my staff and
i want it to be really easy to use and menu driven. I have
each week of their work as a separate worksheet numbered
WK1 - WK52 for the year. I want to know what the code
would be which would automatically select the relevant
worksheet depending on the date, i.e if it is the 1st of
January the macro opens WK1 and if it is the 30th of
December the macro opens WK52.

I.e.

if today = 01 Jan, 02 Jan, 03 Jan, 04 Jan, 05 Jan, 06 Jan,
or 07 Jan open 'WK1!'A1

etc.

Anyone know how i may do this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Opening a Worksheet Dependant on Date

Jan 01 could start on any day of the week - your weeks are just 7 day
increments starting from Jan 01 without regard to the day of the week?

--
Regards,
Tom Ogilvy

"Danny" wrote in message
...
I am creating a work management schedule for my staff and
i want it to be really easy to use and menu driven. I have
each week of their work as a separate worksheet numbered
WK1 - WK52 for the year. I want to know what the code
would be which would automatically select the relevant
worksheet depending on the date, i.e if it is the 1st of
January the macro opens WK1 and if it is the 30th of
December the macro opens WK52.

I.e.

if today = 01 Jan, 02 Jan, 03 Jan, 04 Jan, 05 Jan, 06 Jan,
or 07 Jan open 'WK1!'A1

etc.

Anyone know how i may do this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Opening a Worksheet Dependant on Date

Use a lookup table in a new sheet with 2 columns, the date
of the beginning of the week and the week number. Access
with Now function to get the week number to allow you to
select the appropriate sheet
-----Original Message-----
I am creating a work management schedule for my staff and
i want it to be really easy to use and menu driven. I

have
each week of their work as a separate worksheet numbered
WK1 - WK52 for the year. I want to know what the code
would be which would automatically select the relevant
worksheet depending on the date, i.e if it is the 1st of
January the macro opens WK1 and if it is the 30th of
December the macro opens WK52.

I.e.

if today = 01 Jan, 02 Jan, 03 Jan, 04 Jan, 05 Jan, 06

Jan,
or 07 Jan open 'WK1!'A1

etc.

Anyone know how i may do this?

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Opening a Worksheet Dependant on Date

'You could try pasting this into VBA module on your spreadsheet,
'save it and then hopefully when you open the spreadsheet it'll
'select the relevant sheet, as long as they're named WK1, WK2 etc.

Sub Auto_Open()
AccessThisWeeksWork
End Sub

Sub AccessThisWeeksWork()
Dim TheDate As Date
TheDate = Now '
CurrentWeeksWorksheet = "WK" & DatePart("ww", TheDate)
Sheets(CurrentWeeksWorksheet).Activate
End Sub

'If you look at the Excel VBA help under "DatePart" you can set which day
'of the week is the first day & you can also set which week of the year
'is the first week.

'Rabbit
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
On opening a worksheet move focus to a cell based on date davcas Excel Worksheet Functions 1 July 1st 08 02:18 PM
I require code to run a macro dependant on the date Marie Bayes Excel Discussion (Misc queries) 7 January 15th 07 03:48 PM
Using parameters to use different source files dependant on the date. stuckupnorth Excel Discussion (Misc queries) 1 February 8th 06 07:20 PM
Date dependant values. Big Rick Excel Discussion (Misc queries) 6 June 23rd 05 08:16 PM
Formula dependant on month/date Ravi Sandhu Excel Programming 0 September 13th 03 12:32 PM


All times are GMT +1. The time now is 11:54 PM.

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

About Us

"It's about Microsoft Excel"