Announcement

Collapse
No announcement yet.

Unconfigured Ad Widget

Collapse

Determine Day Name Of Current Date

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    Re: Run Daily Vbcode

    Code:
    select case format(now(),"dddd")
    case is "Monday" then
        set wsReport = thisworkbook.worksheets("Monday")
    case is "Tuesday" then
        set wsReport = thisworkbook.worksheets("Tuesday")
    etc...

    Comment


    • #3
      Re: Run Daily Vbcode

      Thanks! i will give that a go.

      Comment


      • #4
        Re: Run Daily Vbcode

        Slighty Better approach

        Code:
        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

        Comment


        • #5
          Re: Run Daily Vbcode

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

          Comment


          • #6
            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

            Comment

            Trending

            Collapse

            There are no results that meet this criteria.

            Working...
            X