LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default prob with dates in VBA

Dim StartDate As Date
Dim EndDate As Date

StartDate = Date - Weekday(Date, 2) + 1
EndDate = StartDate + 4

For i = StartDate To EndDate
Cells(2, i+5).Value = i
Cells(2, i+5).Numberformat = "dd/mm/yyyy"
Next i

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"dee" wrote in message
...
But how do i writ e ths peice of code so taht my column F2 to J2 get
filled
with dates

"Bob Phillips" wrote:

Dim StartDate As Date
Dim EndDate As Date

StartDate = Date - Weekday(Date, 2) + 1
EndDate = StartDate + 4


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"dee" wrote in message
...
How do i say within a macro taht my dates for a workweek should be
static.
like 03/Mar to 7/Mar should remain static for thsi week and when i m in
next
week when i open this same sheet it shud give me last week's dates
only..(this is to maintain versions)
but the date has to be dynamic. taht is when i run a macro, when im in
a
currenty week it shud show me the current week's 5 days only.... as 5
columns.
but when i open the version of teh sheet that i opened l;ast week it
shud
give me last weeks dates only








 
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
CSE Formula Prob pdberger Excel Worksheet Functions 4 February 16th 08 03:51 AM
vlookup prob with all #n/a's Janis Excel Discussion (Misc queries) 5 July 30th 07 10:26 PM
Macro Prob Carl Excel Worksheet Functions 3 August 28th 06 05:03 PM
Counting prob superkopite Excel Discussion (Misc queries) 13 January 23rd 06 09:18 AM
A little help, prob simple to anyone else john_w100 New Users to Excel 5 June 17th 05 01:47 PM


All times are GMT +1. The time now is 03:06 PM.

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"