LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default -PLS CONSIDER THIS AS URGENT! HOW TO PUT SUM FORMULA IN VB FOR A CHANGING MULTI CATEGORY OR GROUP

On Feb 19, 3:28 am, "merjet" wrote:
Sub DoSums()
Dim sSubTotal As Single
Dim sTotal As Single
Dim ws As Worksheet
Dim iRow As Integer

Set ws = Sheets("Sheet1")
iRow = 10
Do
Do
sSubTotal = sSubTotal + ws.Cells(iRow, 2)
sTotal = sTotal + ws.Cells(iRow, 2)
iRow = iRow + 1
Loop Until ws.Cells(iRow, 1) = ""
ws.Cells(iRow, 2) = sSubTotal
sSubTotal = 0
Loop Until ws.Cells(iRow, 1) = "" And ws.Cells(iRow + 1, 1) = ""
ws.Cells(iRow, 2) = sTotal
End Sub

Hth,
Merjet


Thnk u Merget. It has been whole day trying to figure out and I have
to get the formula placed bcos every time the staff wont be running
the procedure. Once the group of tanks are changed I want to put the
formulas automatically thro VB. The problem is to put down exactly
what I want. I will take another shot tomoro and ur code is totally
different from the one i hv been trying. Will try yours too to see
what it does. let me try one more time to explain to u in a
different way.\

out of 24 tanks-- i might be asked load cargo into groups. So one
time it might be all the 24 tanks as one group. Then I have to have
only one total . Some time they might say load in 2 groups. then I
hv to split 24 tanks into two groups of say 10 tanks and 14 tanks. In
this case i need to have sub totals of each group and grand total of
group1 and group2. Like this they may say load in 4 groups. Then I
might need sub totals and grand total accly. So if u can take time to
see my first post where I have mentioned the way I require to be
done. Mr Bob has sugested the code. Only drawback is he is presuming
that the cells below are empty. I have other data below b40 and hence
using xldown or last cell does not work bcos it goes another may be 50
cells down bcos of data about 3 rows below b40.

 
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
Multi-Level Category Labels Jared Charts and Charting in Excel 1 December 4th 09 12:22 AM
How do I format multi-level category labels RGun Charts and Charting in Excel 1 November 6th 09 10:33 PM
Multi level category labels Tigerxxx Excel Discussion (Misc queries) 0 July 31st 09 07:28 AM
Multi-Level Category Gridlines GS80 Charts and Charting in Excel 3 January 24th 08 02:47 PM
representing multi category in a column chart hokum Charts and Charting in Excel 2 July 6th 05 01:03 PM


All times are GMT +1. The time now is 01:59 PM.

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"