Hi,
I've got the code to run, without any errors. But nothing seems to
happen. I should get a counts in column AG. But nothing
Sub CountFromRightToFirstBlank()
Dim lngCol As Long
Dim lngRow As Long
Dim lngLastRow As Long
Dim lngCount As Long
'Considering that Column A always have value
lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row
'the last col that will be counted
lngCol = 19
'start counting from row 2
For lngRow = 2 To lngLastRow
'loop from col E,D,C, B
'you can change the condition that suit you
Do Until Cells(lngRow, lngCol).Value = "" Or lngCol = 1
lngCount = lngCount + Cells(lngRow, lngCol).Value
lngCol = lngCol - 1
Loop
'At last, if there is value in the count,
'write the result in column F
If lngCount < 0 Then
Cells(lngRow, "AG").Value = lngCount
End If
lngCount = 0
lngCol = 19
Next
End Sub
--
harpscardiff
------------------------------------------------------------------------
harpscardiff's Profile:
http://www.excelforum.com/member.php...o&userid=25960
View this thread:
http://www.excelforum.com/showthread...hreadid=393287