Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2008

Tip: Looking for answers? Try searching our database.

extra command

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jkf - 24 Jan 2008 18:13 GMT
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
Gord Dibben - 24 Jan 2008 19:38 GMT
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

>is it possible for excel to move on to the day using the pc clock,
>
[quoted text clipped - 14 lines]
>
>JKF
jkf - 24 Jan 2008 20:20 GMT
thank you worked a treat

many thanks

JKF

> Sub pick_today()
> Dim ws As Worksheet
[quoted text clipped - 36 lines]
>>
>>JKF
Gord Dibben - 24 Jan 2008 22:49 GMT
Thanks for the feedback.

Gord

>thank you worked a treat
>
[quoted text clipped - 42 lines]
>>>
>>>JKF
Dave Peterson - 24 Jan 2008 23:48 GMT
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.

> is it possible for excel to move on to the day using the pc clock,
>
[quoted text clipped - 14 lines]
>
> JKF

Signature

Dave Peterson

Gord Dibben - 25 Jan 2008 00:20 GMT
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

>Another option based on Gord's code:
>
[quoted text clipped - 37 lines]
>>
>> JKF
Dave Peterson - 25 Jan 2008 03:11 GMT
You're welcome.

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

> Thanks for the input Dave.
>
[quoted text clipped - 47 lines]
> >>
> >> JKF

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.