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 Help with Dates

Hi all,
I am trying to populate a combobox for timesheet application with all week
ending dates for our accounting year. Our year runs from April 1st - March
31st.

Code below shows where I have got to so far and works in part. However, I
can't figure out how to stop the code after the end of the accounting year
month.

variable values are obtained as follows:
Startweek value is the next timesheet date in fomat dd/mm/yyyy
This value would start at first week ending date for accounting year and is
incremented by 1 week each time timsheet is submitted.

yearendmonth value is the month / year date accounting period ends in format
dd/mm/yyyy this value is taken from an excel spreadsheet calendar which I
update each year.

How would i need to alter the code to show all week ending dates for each
month in the accounting year only?
Hope I have made myself clear - if someone could kindly assist me with this
please, I would be most grateful.


Private Sub UserForm_Initialize()
Dim startweek As Date
Dim yearendmonth As Date
startweek = ThisWorkbook.Worksheets("Timesheet").Range("K8").V alue
yearendmonth =
ThisWorkbook.Worksheets("YearlyCalendar").Range("S 36").Value

hyear = Year(yearendmonth)

With ComboBox1
.Clear
NextDate = DateValue(startweek)
Do
.AddItem Format(NextDate, "dd/mm/yyyy")
WeekDate = NextDate
IntervalType = "ww"
Number = 1

'change week ending to next sunday
NextDate = DateAdd(IntervalType, Number, WeekDate)

Loop Until Year(NextDate) hyear
.Text = startweek
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
Linking computer dates (time) to spreadsheet dates that have formu bigisle Excel Worksheet Functions 3 January 3rd 10 08:05 PM
Toggle a range of Julian dates to Gregorian Dates and Back PSKelligan Excel Programming 4 May 8th 07 05:51 AM
Identifying unique dates in a range of cells containing dates... cdavidson Excel Discussion (Misc queries) 4 October 13th 06 03:30 PM
need to convert list of dates to count no. of dates by week neowok Excel Worksheet Functions 13 January 30th 06 03:54 PM
Calculating number of days between two dates that fall between two other dates [email protected] Excel Discussion (Misc queries) 5 October 26th 05 06:18 PM


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