Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Using a date to move a Worksheet


Hello form Steved

I have an excel file with 2 worksheets

Sheet1 is Named "Normal" Normal timetable.
Sheet2 is Named "School" School Holiday timetable.

Has anybody being able to apply a date to move worksheets

Whats my objective?

The both sheets are bus timetables

What is required is that on 05-Jul-09 Sheet1 and sheet2 swap places
Then on 18-Jul-09 Swap back.

I Thankyou.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Using a date to move a Worksheet


You will need to change the date formats to satisfy your system
requirements, but it compiled OK. You need to test it, I did not. Put in
the ThisWorkbook code module.

Private Sub Workbooks_Open()
If DateValue(Date) = DateValue("7/5/09") Then
Sheets("Normal").Move After:=Sheets("School")
ElseIf DateValue(Date) = DateValue("7/18/09") Then
Sheets("School").Move After:=Sheets("Normal")
End If
End Sub



"Steved" wrote in message
...
Hello form Steved

I have an excel file with 2 worksheets

Sheet1 is Named "Normal" Normal timetable.
Sheet2 is Named "School" School Holiday timetable.

Has anybody being able to apply a date to move worksheets

Whats my objective?

The both sheets are bus timetables

What is required is that on 05-Jul-09 Sheet1 and sheet2 swap places
Then on 18-Jul-09 Swap back.

I Thankyou.






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Using a date to move a Worksheet


Hello JLGWhiz

I'll shall test it and let you know how I got on.

Steved

ps Thankyou.



"JLGWhiz" wrote:

You will need to change the date formats to satisfy your system
requirements, but it compiled OK. You need to test it, I did not. Put in
the ThisWorkbook code module.

Private Sub Workbooks_Open()
If DateValue(Date) = DateValue("7/5/09") Then
Sheets("Normal").Move After:=Sheets("School")
ElseIf DateValue(Date) = DateValue("7/18/09") Then
Sheets("School").Move After:=Sheets("Normal")
End If
End Sub



"Steved" wrote in message
...
Hello form Steved

I have an excel file with 2 worksheets

Sheet1 is Named "Normal" Normal timetable.
Sheet2 is Named "School" School Holiday timetable.

Has anybody being able to apply a date to move worksheets

Whats my objective?

The both sheets are bus timetables

What is required is that on 05-Jul-09 Sheet1 and sheet2 swap places
Then on 18-Jul-09 Swap back.

I Thankyou.







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Using a date to move a Worksheet


Hi Steved, You should switch the dates in the If statement so that the later
date is tested first. Otherwise, the earlier date will test true each time
and the sheets will not change on the 18th.

"Steved" wrote:

Hello JLGWhiz

I'll shall test it and let you know how I got on.

Steved

ps Thankyou.



"JLGWhiz" wrote:

You will need to change the date formats to satisfy your system
requirements, but it compiled OK. You need to test it, I did not. Put in
the ThisWorkbook code module.

Private Sub Workbooks_Open()
If DateValue(Date) = DateValue("7/5/09") Then
Sheets("Normal").Move After:=Sheets("School")
ElseIf DateValue(Date) = DateValue("7/18/09") Then
Sheets("School").Move After:=Sheets("Normal")
End If
End Sub



"Steved" wrote in message
...
Hello form Steved

I have an excel file with 2 worksheets

Sheet1 is Named "Normal" Normal timetable.
Sheet2 is Named "School" School Holiday timetable.

Has anybody being able to apply a date to move worksheets

Whats my objective?

The both sheets are bus timetables

What is required is that on 05-Jul-09 Sheet1 and sheet2 swap places
Then on 18-Jul-09 Swap back.

I Thankyou.







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
Move to a named worksheet from any worksheet in the same workbook tango Excel Programming 2 December 10th 08 12:43 AM
On opening a worksheet move focus to a cell based on date davcas Excel Worksheet Functions 1 July 1st 08 02:18 PM
Move Range with a date to a Matching Monthly Worksheet RyanH Excel Programming 5 January 10th 08 08:04 PM
Unable to Insert Worksheet/Move and copy worksheet Excel 2003 lukerush Excel Worksheet Functions 2 September 7th 06 05:05 PM
How do I use vb to move from worksheet to worksheet in a workbook. Ed123 Excel Programming 3 March 9th 05 03:59 PM


All times are GMT +1. The time now is 07:37 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"