A
Arne Hegefors
Hi!
I have a macro that reads two dates from a worksheet, one start date and one
end date. I then run a long macro based on these dates that preforms
calculations for each date starting with the start date and ending with the
end date. This works fine. Now the problem is that the macro does this for
all days, including saturdays and sundays. I only want to do calculations for
weekdays. How can I solve this? Here is my code so:
'Read startdate and enddate
Dim datStartdate As Date
datStartdate = Application.ThisWorkbook.Sheets("Settings").Cells(6, 3)
Dim datEndDate As Date
datEndDate = Application.ThisWorkbook.Sheets("Settings").Cells(7, 3)
'Start loop
Dim datDate As Date
datDate = datStartdate
Dim strDate As String
Do While datDate <= datEndDate
strDate = CStr(Format(datDate, "yyyymmdd"))
Call RunUpdate(strDate)
datDate = datDate + 1
Loop
Any help appreciated! Thanks alot!
I have a macro that reads two dates from a worksheet, one start date and one
end date. I then run a long macro based on these dates that preforms
calculations for each date starting with the start date and ending with the
end date. This works fine. Now the problem is that the macro does this for
all days, including saturdays and sundays. I only want to do calculations for
weekdays. How can I solve this? Here is my code so:
'Read startdate and enddate
Dim datStartdate As Date
datStartdate = Application.ThisWorkbook.Sheets("Settings").Cells(6, 3)
Dim datEndDate As Date
datEndDate = Application.ThisWorkbook.Sheets("Settings").Cells(7, 3)
'Start loop
Dim datDate As Date
datDate = datStartdate
Dim strDate As String
Do While datDate <= datEndDate
strDate = CStr(Format(datDate, "yyyymmdd"))
Call RunUpdate(strDate)
datDate = datDate + 1
Loop
Any help appreciated! Thanks alot!