473,327 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,327 developers and data experts.

Function to Move (Forwards or Backwards) Through Weekdays

NeoPa
32,556 Expert Mod 16PB
This code is quite old and may be bettered.
If anyone feels they can produce better code for this function go ahead and PM me your effort. If I feel that it is better (More efficient & 100% accurate) then I will replace this with it.
Until then, it is at least a usable version that visitors can use when they're in need.

Expand|Select|Wrap|Line Numbers
  1. 'MoveWD moves datThis on by the intInc weekdays.
  2. Public Function MoveWD(datThis As Date, intInc As Integer) As Date
  3.     MoveWD = datThis
  4.     For intInc = intInc To Sgn(intInc) Step -Sgn(intInc)
  5.         MoveWD = MoveWD + Sgn(intInc)
  6.         Do While (Weekday(MoveWD) Mod 7) < 2
  7.             MoveWD = MoveWD + Sgn(intInc)
  8.         Loop
  9.     Next intInc
  10. End Function
Jan 21 '07 #1
0 6987

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tiernan | last post by:
Hi all I'm looking for a way to find the number of weekdays between 2 dates In my form I have three fields for a begin date (dd)(mm)(yyyy) and three for the end date (dd)(mm)(yyyy) Now these...
10
by: JJA | last post by:
I'm trying to use document.getElementByID inside a function where the ID is passed as an argument. I get the same error ("Element has no properties") on the same statement inside the commonCheck...
26
by: MLH | last post by:
How would I modify the following to achieve a 2-dimensional array? Dim MyWeek, MyDay MyWeek = Array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun") ' Return values assume lower bound set to 1...
5
by: Daniel Rudy | last post by:
Hello Group, I've looked at this backwards and forwards and I can't seem to find the problem here. What happens is I have a multidimensional array of char that has 3 dimensions with a...
4
by: MLH | last post by:
I'm thinking of an integer field in which I could write values up to 1+2+4+8+16+32+64 and to use these values later. Each of the individual values would represent a weekday from Sunday to Saturday....
1
by: anupamaavadutha | last post by:
hi all, iam new to javascript. i have problem calling javascript functions.iam designing a calender page.here is my code. <%@ page...
1
by: Orestis Markou | last post by:
Hello, I'm the developer of PySmell ( http://github.com/orestis/pysmell ), a static analysis/intellisense provider for Python. I am targeting Python 2.4 code so I'm using the compiler package. ...
0
by: Terry Reedy | last post by:
Orestis Markou wrote: My impression is that the 2.6 ast package is quite different from the 2.4 compiler package, but I have not looked at it (in its 3.0 version) yet. If the 2.4 code you are...
18
by: MyWaterloo | last post by:
I quickly put this code together to test if it would disable some of my functions OnChange when my text box (purchase order number) is empty...and if it would enable those functions when I added data...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.