LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Having problem with subtotal helpme out


Hi ,


this is the code i'm using to do summary dynamically because i dont
know no of rows. It will changes every day. I'm facing the problem
with this code. pls help me out.
sttype hr1 hr2
------ -- ---
S7 10 20
S7 30 30
S14 40 30
S14 20 50

OUTPUT. in the last row looks like this.
S7 40 50
S14 60 80.

code:
-----
Sub summary()
Dim srow As Integer
Dim erow As Integer
Dim STYPE As String
Dim STVALUE As String
Dim LROW As Integer
Dim nrow As Integer
Dim LCONTINUE As Boolean


LROW = 0
nrow = 1
Range("a2").Select
LCONTINUE = True

Do Until Selection.Value = ""
Selection.Offset(1, 0).Select
Loop
endrow = Selection.Row - 1
LROW = LROW + 1
nrow = nrow + 1


STYPE = "A2"
STVALUE = "A" & CStr(LROW)


For lcount = 1 To endrow
'While LCONTINUE = True
If Range(STYPE).Value < Range(STVALUE).Value Then
Range("b" & endrow + 2).Formula = "=SUM(b2:b" & endrow & ")"
Range("b" & endrow + 2 & ":C" & endrow + 2).FillRight
STYPE = "A" & CStr(nrow)
End If
'Wend
Next lcount
End Sub



your help is greatly appreciated.

Thanks,
Ramana.


--
ramse
------------------------------------------------------------------------
ramse's Profile: http://www.excelforum.com/member.php...o&userid=31544
View this thread: http://www.excelforum.com/showthread...hreadid=512743

 
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
Subtotal Problem Salman Excel Worksheet Functions 3 March 29th 07 10:08 AM
Subtotal for each column problem ef Excel Programming 3 December 16th 04 10:26 PM
Subtotal & #n/a problem [email protected] Excel Programming 3 December 16th 04 07:43 AM
subtotal problem pcscsr[_6_] Excel Programming 0 November 1st 04 09:49 PM
subtotal problem pcscsr[_5_] Excel Programming 1 October 31st 04 10:54 PM


All times are GMT +1. The time now is 04:25 AM.

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

About Us

"It's about Microsoft Excel"