Thread: excel VBA code
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Shane Devenshire[_2_] Shane Devenshire[_2_] is offline
external usenet poster
 
Posts: 3,346
Default excel VBA code

Hi,

The Day function does not return the weekday it returns the day of the month.

Instead you could use

If Weekday(Date) = 7 Then

Else

End if

7 is the value for Saturday; Sunday = 1. If you're not coding a msgbox then
this would be a possibe branch.

If you want to handle the entire week consider using

Select Case Weekday(Date)
Case 1 'Sunday
'your code here
Case 2 'Monday
...

Case Else

End Select



--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Dana DeLouis" wrote:

Instead of generating a string ("saturday") perhaps...

If Day(Date) = vbSaturday Then
'Your code...
Else
'Something else
End If

= = =
Dana DeLouis


Savio wrote:
thanks. do you know how i could incorporate that into an if statement.
Say : if today is saturday, follow a set of commands, else do
something else?