ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programming dates (https://www.excelbanter.com/excel-programming/272635-programming-dates.html)

TB[_3_]

Programming dates
 
I have a weekending (Saturday) date in cell G5 programmed as follows:

TheDate = Format(Now + 7 - Weekday(Now), "mm/dd/yy")

The cells in rows B10 through B16 hold numerical data, and correspond to
days of the week (Sunday through Saturday). I need to check for a number 0
in each cell in the above range, and use the above date to insert both the
date and numerical data elsewhere in the workbook (see pseudocode below).

For Range("B10:B16").Cells
If range("B10").Value 0 Then
NewDate = range("G5").value - 6 days(Sunday) (need a way to program
this line)
Worksheets("Sheet2").Range("A3").End(xlUp).Offset( 1,0).Value = NewDate
Worksheets("Sheet2").Range("B3").End(xlUp).Offset( 1,0).Value =
Range("B10").Value
End If
Next

I hope you can understand what I'm trying to do from the above. I can't seem
to find a way to program the date for each day, and when I try to transfer
the data to a new worksheet, I get 1 date from the first number, 2 dates
from the second number, 3 dates from the third, and on and on. Please help!

TB




All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com