Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date entry using a macro
Hey guys,
Have searched the forum and cant find the answer to this one! I am trying to enter in a date in a cell using a macro; the date needs to be 3 working days before todays date. I thought i could utilise the NETWORKDAYS function, but cant seem to do it. Thanks in advance Dan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date entry using a macro
Hi Disco;
Use this; ActiveCell = Date - 3 Thanks, Greg -----Original Message----- Hey guys, Have searched the forum and cant find the answer to this one! I am trying to enter in a date in a cell using a macro; the date needs to be 3 working days before todays date. I thought i could utilise the NETWORKDAYS function, but cant seem to do it. Thanks in advance Dan . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date entry using a macro
=WORKDAY(TODAY(),-3)
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "disco" wrote in message ... Hey guys, Have searched the forum and cant find the answer to this one! I am trying to enter in a date in a cell using a macro; the date needs to be 3 working days before todays date. I thought i could utilise the NETWORKDAYS function, but cant seem to do it. Thanks in advance Dan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date entry using a macro
hi
try this: Sub maccount3() Dim c As Variant Dim ctr As Integer c = Date ctr = 3 Do While ctr = 1 If Weekday(c) = 1 Then c = c - 2 Else ctr = ctr - 1 c = c - 1 End If Loop MsgBox "3 Days from now(not counting weekends) is " & c c.Value = Range("mycell").Value End Sub -----Original Message----- Hey guys, Have searched the forum and cant find the answer to this one! I am trying to enter in a date in a cell using a macro; the date needs to be 3 working days before todays date. I thought i could utilise the NETWORKDAYS function, but cant seem to do it. Thanks in advance Dan . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date entry using a macro
Yes it is, it is part of the Analysis Toolpak, just like Networkdays
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "disco" wrote in message ... thanks guys, much appreciated! used if statements and the weekday function in the end, as workday is not available in VBA!! thanks again "Frank Stone" wrote: hi try this: Sub maccount3() Dim c As Variant Dim ctr As Integer c = Date ctr = 3 Do While ctr = 1 If Weekday(c) = 1 Then c = c - 2 Else ctr = ctr - 1 c = c - 1 End If Loop MsgBox "3 Days from now(not counting weekends) is " & c c.Value = Range("mycell").Value End Sub -----Original Message----- Hey guys, Have searched the forum and cant find the answer to this one! I am trying to enter in a date in a cell using a macro; the date needs to be 3 working days before todays date. I thought i could utilise the NETWORKDAYS function, but cant seem to do it. Thanks in advance Dan . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Autofill date on date entry in a separate column | Excel Worksheet Functions | |||
Excel 2002 date entry: Cannot get away from d-m-yy entry format | Excel Discussion (Misc queries) | |||
Restricting date entry relative to current date | Excel Worksheet Functions | |||
last entry of a particular date | Excel Discussion (Misc queries) | |||
Date entry | Excel Discussion (Misc queries) |