calculate
Thanks but the first if always returns true
I have the following:
Worksheets("Sheet1").Activate
For Each cell In Range("A1:A50")
If IsEmpty(cell) Then
startdate = Date
Else
startdate = cell
End If
My worksheet has data in row A1 and A2.
What am I doing wrong?
Thanks again
"Tom Ogilvy" wrote in message
...
for each cell in Range("A2:A50")
if isempty(cell) then
startdate = date
else
startdate = cell
End if
if cell.offset(0,1) = "" then exit for
Set fromsheet = ActiveSheet
Receipts = fromsheet.Cells(6, 3)
Amount = cell.offset(0,2).Value
wks = DateDiff("ww", startdate, Now)
bal = Receipts - (wks * Amount)
Next
--
Regards,
Tom Ogilvy
"Newbie" wrote in message
...
Hi
I want to be able to calculate a figure based on the no. of weeks
between
a
range of dates.
eg.
Records:
Date From Date To Amount
3/11/03 17/11/03 120
18/11/03 7/12/03 130
8/12/03 - 150
If the date to field is blank then today's date is to be used
At the moment I have the following:
startdate = "24/11/2003"
Set fromsheet = ActiveSheet
Receipts = fromsheet.Cells(6, 3)
wks = DateDiff("ww", startdate, Now)
bal = Receipts - (wks * 120)
This works fine if the amount is always 120 and the start date is always
24/11/2003.
How can I change it so that
bal = the addition of No. of weeks between each date in the table * the
applicable amount?
The # of records will always be increasing - somehow I need to be able
to
calculate each record separately
Thanks
|