I am trying to calculate date differences for vacations and I don't want to include Saturday or Sunday. I wrote some code but it doesn't work (obviously). I did a keyword search and found nothing for Excel. I thought there was a Function in Excel that would do this but I guess not? Any help would be great.
Sub dude()
Dim newnum As Range
Dim startday As Date
Dim lastday As Date
Dim count As Integer
count = 0
startday = Cells(1, 1)
lastday = Cells(1, 2)
mydays = DateDiff("d", startday, lastday)
Set newnum = mydays
For Each d In newnum
If Weekday(d) <> 1 Or Weekday(d) <> 7 Then
count = count + 1
End If
Next d
Cells(4, 1) = count
End Sub
I may not be very smart but I'm sure wirey!!!!
Sub dude()
Dim newnum As Range
Dim startday As Date
Dim lastday As Date
Dim count As Integer
count = 0
startday = Cells(1, 1)
lastday = Cells(1, 2)
mydays = DateDiff("d", startday, lastday)
Set newnum = mydays
For Each d In newnum
If Weekday(d) <> 1 Or Weekday(d) <> 7 Then
count = count + 1
End If
Next d
Cells(4, 1) = count
End Sub
I may not be very smart but I'm sure wirey!!!!