View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_854_] joel[_854_] is offline
external usenet poster
 
Posts: 1
Default Can I loop this?


Dates are number with the first day Jan 1, 1900 and each day equal 1.
this code should work


Private Sub CB1_Click()

StartDate = DateValue("020110")
EndDate = DateValue("022710")


With ThisWorkbook.Worksheets("February")
For MyDate = StartDate To EndDate
Yesterday = Format(MyDate - 1, "MMDDYY")
DateStr = Format(MyDate, "MMDDYY")

.Range("B5").Value = _
Worksheets(Yesterday).Range("B5").Value + _
Worksheets(DateStr).Range("B5").Value
Next MyDate
End With
End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=193373

http://www.thecodecage.com/forumz