Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofill date on date entry in a separate column lemonshark Excel Worksheet Functions 2 February 18th 10 05:11 PM
Excel 2002 date entry: Cannot get away from d-m-yy entry format Steve Eklund Excel Discussion (Misc queries) 3 May 11th 09 04:57 PM
Restricting date entry relative to current date bwalshjr Excel Worksheet Functions 1 April 10th 07 12:49 PM
last entry of a particular date shaji Excel Discussion (Misc queries) 1 July 29th 06 03:54 PM
Date entry magstate Excel Discussion (Misc queries) 2 March 23rd 05 07:15 PM


All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"