Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to make a macro with user input for counting the difference in days. I would like to have the user input the start date and finish date. Also I would like 3 answers to be given. Answer 1 Count days in 7 day week which includes weekends (Sat and Sun). Answer 2 Count days in a 6 day week with Saturdays only on weekends. Answer 3 Count days in a 5 day week which excludes weekends. Also I would like to have the option of whether or not to include my named range Holidays located in column "F". This is what I have to start with and modify: Sub DayDiff() Dim sDate As String Dim intNumDays As Integer On Error GoTo errhandler ' Prompt for a date. sDate = InputBox$("Enter a date in the mm/dd/yy format") ' Get difference between dates. intNumDays = CInt(DateValue(sDate) - Now()) ' Determine if difference is past or future. If Sgn(intNumDays) = 1 Then MsgBox "Days between " + sDate + " and today :" + CStr(intNumDays) Else MsgBox "The date " + sDate + " was" + CStr(Abs(intNumDays)) _ + " day(s) ago." End If errhandler: If Err 0 Then MsgBox "Please enter a valid date." End Sub Any help that anyone could provide would be greatly appreciated. -- By persisting in your path, though you forfeit the little, you gain the great. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count distinct days from two groups of days | Excel Worksheet Functions | |||
Count Days more than 180 days prior to today | Excel Worksheet Functions | |||
When word says Install I want it count the days for 3 days w.o wee | Excel Worksheet Functions | |||
COUNT how many ROWS ago out of 10 days that the highest high in 10 days was made | Excel Worksheet Functions | |||
i have two days and i want the difference in days, months, year | Excel Worksheet Functions |