Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default compile error - pls help

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


--

HTH

RP

"tango" wrote in message
om...
dear all, how to sum up the total for each of the category below in
vba? when next row is empty then can do a sum up. for example a shell
and head will be 4650 when encounter an empty row after linda.
can help. thanks


a shell and head
andy 50
sussy 100
linda 4500

b nozzle
james 98
zortan 340

c manhole
bryan 34
fendi 444

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default compile error - pls help

Hi
wha compile error did you get exactly and in which lines

"tango" wrote:

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


--

HTH

RP

"tango" wrote in message
om...
dear all, how to sum up the total for each of the category below in
vba? when next row is empty then can do a sum up. for example a shell
and head will be 4650 when encounter an empty row after linda.
can help. thanks


a shell and head
andy 50
sussy 100
linda 4500

b nozzle
james 98
zortan 340

c manhole
bryan 34
fendi 444


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solver - error - Compile Error Nina Excel Discussion (Misc queries) 0 August 19th 08 09:41 PM
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM
Compile error in hidden module error Melissa Zebrowski Excel Programming 3 February 20th 04 01:29 PM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"