LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default DateAdd

Hi all,
I have a combobox on a form which I am trying to populate with week ending
dates (Sunday) from a fixed start point to a current date contained in a cell.

I have put together the following code but it is not giving the required
result. can someone be kind engough to tell me where I have gone wrong please.
Many thanks

Private Sub UserForm_Initialize()
Dim startweek As Date
Dim thisweek As Date
startweek = "04/06/2006"
thisweek = ThisWorkbook.Worksheets("FormData").Range("K8").Va lue

With ComboBox1
.Clear
For NextDate = startweek To thisweek

WeekDate = NextDate
IntervalType = "ww"
Number = 1

'change weekending to next sunday
NextDate = DateAdd(IntervalType, Number, WeekDate)
.AddItem Format(NextDate, "dd/mm/yyyy")
Next NextDate
End With
End Sub

--
JB
 
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
Dateadd function Dr. Maunuk Excel Discussion (Misc queries) 2 September 28th 07 07:32 AM
dateadd The BriGuy[_2_] Excel Discussion (Misc queries) 1 March 29th 07 06:51 PM
DateAdd Michael Wise[_7_] Excel Programming 1 August 27th 04 07:40 PM
Using DateAdd with a text string Max Excel Programming 2 February 18th 04 02:10 AM
DateAdd function Bill[_19_] Excel Programming 2 November 12th 03 07:07 PM


All times are GMT +1. The time now is 05:36 AM.

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

About Us

"It's about Microsoft Excel"