How to highlight a week if the week number is given. e.g. against week number 22, the form must show the dates ranging between 2/july/08 to 9/july/08.

Thanx in advance :)

Recommended Answers

All 2 Replies

findout the days .

add those many days to 1st of jan

then highlight those days.

Hi,
You can use DateAdd () Function

Syntax
DateAdd ( Interval As String, Number As Double, DateValue As Date ) As Date

Parameters
Interval - String expression representing the time interval you want to add
Give interval as "ww" for week
Number - Floating-point expression representing the number of intervals you want to add
Date - An expression representing the date and time to which the interval is to be added

Example

Dim DateRangeFrom As Date
   Dim DateRangeTo As Date
   Dim WeekOfTheYear As Integer
   
   WeekOfTheYear = 22
   
   DateRangeFrom = DateAdd("ww", WeekOfTheYear - 1, CDate("1/1/2008"))
   DateRangeTo = DateRangeFrom + 7
   MsgBox " From " & DateRangeFrom & " To " & DateRangeTo
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.