Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.newusers
|
|||
|
|||
Doesn't Add Up
Hi,
the third 'If' statement is supposed to count all of the dates in the 7th column & not the blank cells. Any idea why it won't work (returns a result of '0') Like I said before, novice! Cheers. Dim i As Integer, c As Integer, d As Integer, e As Integer d = 0 c = 0 e = 0 For i = 27 To 321 If Cells(i, 6).Value < Now Then d = d + 1 If Cells(i, 6).Value < Now And Cells(i, 7).Value = "" Then c = c + 1 If Cells(i, 7).Value < "" Then e = e + 1 End If End If End If Next i |
#2
Posted to microsoft.public.excel.newusers
|
|||
|
|||
Doesn't Add Up
It will never get there
Dim i As Integer, c As Integer, d As Integer, e As Integer d = 0 c = 0 e = 0 For i = 27 To 321 If Cells(i, 6).Value < Now Then If Cells(i, 7).Value = "" Then c = c + 1 Else d = d + 1 End If ElseIf Cells(i, 7).Value < "" Then e = e + 1 End If Next i "egibberate" wrote in message ... Hi, the third 'If' statement is supposed to count all of the dates in the 7th column & not the blank cells. Any idea why it won't work (returns a result of '0') Like I said before, novice! Cheers. Dim i As Integer, c As Integer, d As Integer, e As Integer d = 0 c = 0 e = 0 For i = 27 To 321 If Cells(i, 6).Value < Now Then d = d + 1 If Cells(i, 6).Value < Now And Cells(i, 7).Value = "" Then c = c + 1 If Cells(i, 7).Value < "" Then e = e + 1 End If End If End If Next i |
#3
Posted to microsoft.public.excel.newusers
|
|||
|
|||
Doesn't Add Up
Sorry Bob,
I should have included the last part so you know what I'm doing. MsgBox Str(d) & Chr(32) & "Target Code Dates" & Chr(13) & Str(c) & Chr _ (32) & "Target Deficit" & Chr(13) & Str(e) & Chr(32) & "Machines shipped so far" Column 6 & 7 are both date columns. Column 6 is the 'Target Shipping' date & column 7 the 'Actual Shipping date'. From the information I input I can have a Msgbox telling me three things (if I could get the last part to work) ie. How many 'Target Shipping' dates there have been this month, how many 'Shipping Dates' we missed & how many we 'Shipped so far'. Thanks very much for your reply. "Bob Phillips" wrote in message ... It will never get there Dim i As Integer, c As Integer, d As Integer, e As Integer d = 0 c = 0 e = 0 For i = 27 To 321 If Cells(i, 6).Value < Now Then If Cells(i, 7).Value = "" Then c = c + 1 Else d = d + 1 End If ElseIf Cells(i, 7).Value < "" Then e = e + 1 End If Next i "egibberate" wrote in message ... Hi, the third 'If' statement is supposed to count all of the dates in the 7th column & not the blank cells. Any idea why it won't work (returns a result of '0') Like I said before, novice! Cheers. Dim i As Integer, c As Integer, d As Integer, e As Integer d = 0 c = 0 e = 0 For i = 27 To 321 If Cells(i, 6).Value < Now Then d = d + 1 If Cells(i, 6).Value < Now And Cells(i, 7).Value = "" Then c = c + 1 If Cells(i, 7).Value < "" Then e = e + 1 End If End If End If Next i |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|