View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VBA : get a period - fill cells in calendar?

month(Date)

will give you the month number

With Worksheets("Sheet1")
set StartDates = .Range("D4")
set EndDates = .Range("E4")
End With
for i = 1 to 43
lStartMonth = Month(rng(i,1))
lEndMonth = Month(rng(i,2))
. . .
Next i

--
Regards,
Tom Ogilvy


"Gabriele C " wrote in message
...
Tom,thank you for replying...
Sheet(1) d4:d46 is the beginning date (formatted as ddmmYY)
e4:e46 is the ending date (formatted as ddmmYY)
Sheet(2) e4:AI4 contains numers from 1 to 31
c5:c16 contains months labelled from 1 to 12
I thought to write my little code as you said,but my problem is how to
get month from a date...


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