Populate the sheet with date

  • Thread starter Thread starter Patty2005
  • Start date Start date
P

Patty2005

I have a userform which takes input from user like start date and en
date.once I have those I want to find the difference and fill the star
date in A1 and A2 with next day, go on till I reach end date how do I d
that?

format of the date 08/06/2004


Code
-------------------
Sheet3.Activate
Range("B1").Select
ActiveCell.Value = frmCalendar.txtCalendar.Value
Do

ActiveCell.Offset(0, 1).Select
ActiveCell.Value = frmCalendar.txtCalendar.nextDay

Loop Until (ActiveCell.Value = frmCalendar1.txtCalendar1.Value
 
Hi Patty,

Sheet3.Activate

nowDate = frmCalendar.txtCalendar.Value

i=1
Do
With Cells( i,1)
.Value = nowDate
.numberformat = "m/dd/yyyy")
End With
nowDate = nowDate + 1
i = i + 1
Loop Until nowDate > frmCalendar1.txtCalendar1.Value


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
for some reason the code didn't work.it's not filling the values in th
worksheet.so I modified your code a little bit and made it t
work.Thanks for the help


Code
-------------------
Sheet3.Activate
Sheet3.Range("B1").Select
nowDate = frmCalendar.txtCalendar.Value
i = 1
Do
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(0, 1).Select
End If
Loop Until (IsEmpty(ActiveCell) = True)
ActiveCell.Value = nowDate
ActiveCell.NumberFormat = "mm/dd/yyyy"
nowDate = nowDate + 1
i = i + 1
Loop Until nowDate = frmCalendar1.txtCalendar1.Valu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top