Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello all,

    Is there a way to have a macro run a certain set of commands based on the day of the week?

    For example, If the day of the week is Monday, I want it to run something different than it would on a Tuesday.



    Thanks!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can test Weekday(Date):

    Code:
    Sub Test()
      Select Case Weekday(Date)
    	Case vbSunday
      	' Code for Sunday
    	Case vbMonday
      	' Code for Monday
    	Case vbTuesday
      	' Code for Tuesday
    	Case vbWednesday
      	' Code for Wednesday
    	Case vbThursday
      	' Code for Thursday
    	Case vbFriday
      	' Code for Friday
    	Case vbSaturday
      	' Code for Saturday
      End Select
    End Sub

  3. #3
    2 Star Lounger
    Join Date
    Oct 2001
    Location
    Not in KC anymore
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    You can test Weekday(Date):

    Code:
    Sub Test()
      Select Case Weekday(Date)
    	Case vbSunday
      	' Code for Sunday
    	Case vbMonday
      	' Code for Monday
    	Case vbTuesday
      	' Code for Tuesday
    	Case vbWednesday
      	' Code for Wednesday
    	Case vbThursday
      	' Code for Thursday
    	Case vbFriday
      	' Code for Friday
    	Case vbSaturday
      	' Code for Saturday
      End Select
    End Sub
    That worked great. Thanks!

Posting Permissions

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