Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 6 of 6

Thread: Determine Day Name Of Current Date

  1. #1
    Join Date
    28th September 2007
    Posts
    15

    Determine Day Name Of Current Date

    I have got a spreadsheet that needs filling in by 3pm everyday. The workbook has a worksheet for each day e.g. Mon to Fri. What I am looking to do is fill the worksheets in for whatever day it is e.g. if it is monday then select monday data from required file and paste into monday worksheet. I was going to create five macros for each day and then select the required one on the day, but rather than doing this is their a way that i could write one macro that runs by checking what day it is? e.g. if monday run monday code...

    Hope that makes sense.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    9th August 2006
    Posts
    155

    Re: Run Daily Vbcode

    VB:
    Select Case format(now(),"dddd") 
    Case Is "Monday" Then 
        Set wsReport = thisworkbook.worksheets("Monday") 
    Case Is "Tuesday" Then 
        Set wsReport = thisworkbook.worksheets("Tuesday") 
        etc... 
    
    

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    28th September 2007
    Posts
    15

    Re: Run Daily Vbcode

    Thanks! i will give that a go.

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    15th March 2007
    Location
    LONDON, UK
    Posts
    1,377

    Re: Run Daily Vbcode

    Slighty Better approach

    VB:
    Sub x() 
         
         'Select the Weekday(Integer)from todays date
         'using Monday as your first day of the week
         'If you wanted Sunday to be your first day of the week use vbSunday & Change Case Numbers
         
        Select Case DatePart("w", Date, vbMonday) 
        Case 1 
            MsgBox "Mon" 
        Case 2 
            MsgBox "Tue" 
        Case 3 
            MsgBox "Wed" 
        Case 4 
            MsgBox "Thur" 
        Case 5 
            MsgBox "Fri" 
        Case 6 
            MsgBox "Sat" 
        Case 7 
            MsgBox "Sun" 
        End Select 
         
    End Sub 
    
    
    z

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    28th September 2007
    Posts
    15

    Re: Run Daily Vbcode

    Thanks Zimitry.
    Last edited by Dave Hawley; October 24th, 2007 at 18:16.

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,705
    If you wish to continue using this free service.

    Please read the This Page which you agreed to when joining. In particular the point on Thread Titles. After you have done so please CLICK HERE and Private Message Dave Hawley with your acceptance, or non-acceptance of the rules. Please also include a link to this Thread. You can copy this directly from the Address bar of your Browser. When this is done your thread will be re-opened.

    Please take just 3 mins of your time to read: How To Get Your Question Answered...FAST! AND Anatomy Of A Good Thread Title

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Default Pivot Table Date Field To Today/Current Date
    By G8tor4life in forum EXCEL HELP
    Replies: 4
    Last Post: June 5th, 2008, 04:24
  2. Replies: 7
    Last Post: May 30th, 2008, 02:26
  3. Replies: 1
    Last Post: June 21st, 2007, 04:12
  4. Determine Current Date In Macro
    By John Redmond in forum EXCEL HELP
    Replies: 5
    Last Post: November 8th, 2006, 16:53
  5. Determine Current User
    By h in forum EXCEL HELP
    Replies: 10
    Last Post: January 30th, 2006, 01:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno