compile error - pls help

T

tango

dear all/bob,
got alot of error in the syntax. can help.
thanks


From: Bob Phillips
Date Posted: 10/27/2004 3:55:00 AM



Here is some code

Dim i As Long
Dim sHead As String
Dim nTotal

sHead = Left(Range("A1").Value, 1)
nTotal = 0

For i = 1 To Cells(rows.Count, "A").End(xlUp).Row
If Cells(i, "A").Value = "" Then
Cells(i, "A").Value = "Total for " & sHead
Cells(i, "B").Value = nTotal
sHead = Left(Cells(i + 1, "A").Value, 1)
nTotal = 0
Else
nTotal = nTotal + Cells(i, "B").Value
End If
Next i
Cells(i, "A").Value = "Total for " & sHead
Cells(i, "B").Value = nTotal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top