Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Returning Dates - Lead Times

Please help - I'm new to VBA
I have a Calender file, where I match a date. The file contains date
followed by a flag "Y" for weekends and Bank holidays and " " fo
weekdays.
String
1 - 10 = Date
11- 11 = WeekEnd or Bank Holiday
12- 13 = Week Number
14- 14 = Bank Holiday
08/04/2004 15
09/04/2004Y15Y
10/04/2004Y15
11/04/2004Y16
12/04/2004Y16Y
13/04/2004 16
14/04/2004 16
15/04/2004 16
16/04/2004 16
17/04/2004Y16
My problem is that when I find a date match I need to count 4 lead day
with the Flag set to " " (no weekend or bank holidays) and return th
new date. HELP!
Example
oldDate = 08/04/2004 (Day 0)
LeadDays = 4
newDate = 16/04/2004

Code:
Function AddLeadTime(oldDate, LeadDays)
Dim LineData As String, MyStr As String, x
Open "C:\Test Lib\DateFile.txt" For Input As #1 ' Open the file.
Do While Not EOF(1) ' Continue reading until end-of-file.
x = x + 1 ' Line Counter
Line Input #1, LineData ' Read a line of data.
' Store each date from line of data as variable.
MyStr = Mid(LineData, 9, 6) & Mid(LineData, 17, 2)
If oldDate = MyStr Then
Debug.Print oldData, LeadDays, x
End If
Loop
Close #1
End Function

Thanks in advance

--
Message posted from http://www.ExcelForum.com

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
Calculate times between dates and times in Excel Helio Excel Discussion (Misc queries) 1 March 25th 10 04:29 AM
if statements returning dates Clinton Excel Worksheet Functions 4 August 27th 08 04:25 AM
Returning expected dates London Excel Worksheet Functions 1 July 23rd 05 03:31 AM
Dates and times with PST,PDT oilers Excel Worksheet Functions 1 July 21st 05 09:50 PM
Returning Dates - Lead Times Mettext Excel Programming 0 July 14th 04 09:21 AM


All times are GMT +1. The time now is 01:19 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"