Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default extra command

is it possible for excel to move on to the day using the pc clock,

i have a doc that uses sheets for each day of week as in


Sub ADDSHEET()
For G = 31 To 1 Step -1
Sheets.Add.Name = G & ".01.08"
Next G
End Sub

so would it be possoible to add a extra command so it would open the
corresponding sheet dependant on date

hope this makes sense

tia

JKF

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default extra command

Sub pick_today()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = Format(Now, "dd.mm.yy") Then
ws.Select
End If
Next
End Sub

You could place the code into a workbook_open event if you chose to.

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = Format(Now, "dd.mm.yy") Then
ws.Select
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 24 Jan 2008 18:13:33 -0000, "jkf" wrote:

is it possible for excel to move on to the day using the pc clock,

i have a doc that uses sheets for each day of week as in


Sub ADDSHEET()
For G = 31 To 1 Step -1
Sheets.Add.Name = G & ".01.08"
Next G
End Sub

so would it be possoible to add a extra command so it would open the
corresponding sheet dependant on date

hope this makes sense

tia

JKF


  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 4
Default extra command

thank you worked a treat

many thanks

JKF

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Sub pick_today()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = Format(Now, "dd.mm.yy") Then
ws.Select
End If
Next
End Sub

You could place the code into a workbook_open event if you chose to.

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = Format(Now, "dd.mm.yy") Then
ws.Select
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 24 Jan 2008 18:13:33 -0000, "jkf" wrote:

is it possible for excel to move on to the day using the pc clock,

i have a doc that uses sheets for each day of week as in


Sub ADDSHEET()
For G = 31 To 1 Step -1
Sheets.Add.Name = G & ".01.08"
Next G
End Sub

so would it be possoible to add a extra command so it would open the
corresponding sheet dependant on date

hope this makes sense

tia

JKF



  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default extra command

Thanks for the feedback.

Gord

On Thu, 24 Jan 2008 20:20:53 -0000, "jkf" wrote:

thank you worked a treat

many thanks

JKF

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Sub pick_today()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = Format(Now, "dd.mm.yy") Then
ws.Select
End If
Next
End Sub

You could place the code into a workbook_open event if you chose to.

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name = Format(Now, "dd.mm.yy") Then
ws.Select
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 24 Jan 2008 18:13:33 -0000, "jkf" wrote:

is it possible for excel to move on to the day using the pc clock,

i have a doc that uses sheets for each day of week as in


Sub ADDSHEET()
For G = 31 To 1 Step -1
Sheets.Add.Name = G & ".01.08"
Next G
End Sub

so would it be possoible to add a extra command so it would open the
corresponding sheet dependant on date

hope this makes sense

tia

JKF



  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 35,218
Default extra command

Another option based on Gord's code:

Private Sub Workbook_Open()
Dim ws As Worksheet
set ws = nothing
on error resume next
set ws = worksheets(Format(Date, "dd.mm.yy")) 'I like date, Gord likes Now!
on error goto 0
if ws is nothing then
beep 'no sheet by that name
else
application.goto ws.range("a1"), scroll:=true
end if
End Sub

ps. If you use Gord's code, you may want to add:
Exit For
after the
ws.select
line

There's no reason to keep looking.

jkf wrote:

is it possible for excel to move on to the day using the pc clock,

i have a doc that uses sheets for each day of week as in

Sub ADDSHEET()
For G = 31 To 1 Step -1
Sheets.Add.Name = G & ".01.08"
Next G
End Sub

so would it be possoible to add a extra command so it would open the
corresponding sheet dependant on date

hope this makes sense

tia

JKF


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default extra command

Thanks for the input Dave.

As usual, way ahead of me<g

I like posting my amateur code so's I learn how to do it correctly.

BUT...........I don't seem to be too swift on the learning part.


Gord


On Thu, 24 Jan 2008 17:48:38 -0600, Dave Peterson
wrote:

Another option based on Gord's code:

Private Sub Workbook_Open()
Dim ws As Worksheet
set ws = nothing
on error resume next
set ws = worksheets(Format(Date, "dd.mm.yy")) 'I like date, Gord likes Now!
on error goto 0
if ws is nothing then
beep 'no sheet by that name
else
application.goto ws.range("a1"), scroll:=true
end if
End Sub

ps. If you use Gord's code, you may want to add:
Exit For
after the
ws.select
line

There's no reason to keep looking.

jkf wrote:

is it possible for excel to move on to the day using the pc clock,

i have a doc that uses sheets for each day of week as in

Sub ADDSHEET()
For G = 31 To 1 Step -1
Sheets.Add.Name = G & ".01.08"
Next G
End Sub

so would it be possoible to add a extra command so it would open the
corresponding sheet dependant on date

hope this makes sense

tia

JKF


  #7   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 35,218
Default extra command

You're welcome.

I know what you mean! (Where's Tom!?!)

Gord Dibben wrote:

Thanks for the input Dave.

As usual, way ahead of me<g

I like posting my amateur code so's I learn how to do it correctly.

BUT...........I don't seem to be too swift on the learning part.

Gord

On Thu, 24 Jan 2008 17:48:38 -0600, Dave Peterson
wrote:

Another option based on Gord's code:

Private Sub Workbook_Open()
Dim ws As Worksheet
set ws = nothing
on error resume next
set ws = worksheets(Format(Date, "dd.mm.yy")) 'I like date, Gord likes Now!
on error goto 0
if ws is nothing then
beep 'no sheet by that name
else
application.goto ws.range("a1"), scroll:=true
end if
End Sub

ps. If you use Gord's code, you may want to add:
Exit For
after the
ws.select
line

There's no reason to keep looking.

jkf wrote:

is it possible for excel to move on to the day using the pc clock,

i have a doc that uses sheets for each day of week as in

Sub ADDSHEET()
For G = 31 To 1 Step -1
Sheets.Add.Name = G & ".01.08"
Next G
End Sub

so would it be possoible to add a extra command so it would open the
corresponding sheet dependant on date

hope this makes sense

tia

JKF


--

Dave Peterson
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
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Why the extra rows?? Robert Brown Excel Discussion (Misc queries) 3 July 28th 06 03:13 PM
about extra row jinvictor Excel Discussion (Misc queries) 1 June 7th 06 02:24 PM
how do I get rid of extra rows sarahtar Excel Discussion (Misc queries) 1 November 13th 05 03:30 AM
Excel has a "Find Next" command but no "Find Previous" command. Michael Fitzpatrick Excel Discussion (Misc queries) 2 January 10th 05 11:45 PM


All times are GMT +1. The time now is 05:51 AM.

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"