View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default computations at odd but specified locations

this may do what you want, just adjust the sheet name, column and starting row.

Sub test()
Dim ws As Worksheet
Dim lastrow As Long
Dim x As Long
Dim sTotal As Double

Set ws = Worksheets("Sheet1")
lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row
x = 2
Do While x <= lastrow
With ws
Do While .Range("A" & x).Value < "Total"
sTotal = sTotal + .Range("B" & x).Value
x = x + 1
Loop
.Range("B" & x).Value = sTotal
x = x + 1
End With
sTotal = 0
Loop
End Sub

--


Gary Keramidas
Excel 2003


"Utkarsh" wrote in message
...
Hi

Apologies to those who are seeing it again. Since there was no
response on excel.misc group I'm posting here.

I have data available as follows:

Segment Value Percentage
A 2
B 7
C 5
Total
X 3
Y 2
Total
Q 4
W 6
E 3
R 8
Total


Unforrtunately, as you can see, the rows are unequal. I need to put
totals in the cell adjacent to where "Total" occurs. Also, based on
the totals percentage break-ups for each group needs to be computed.
Can someone suggest a way out?