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 Help! Range("startsum").Value = Application.Sum(Selection)


Hi Everyone

I really need help with this one, I've been looking for a solutio
here, but am not getting anywhere.

I have a sheet that is populated with data from another sheet. The dat
is categorized into sectors in the target sheet. The program then need
to give a subtotal of all the records in the range. The table in th
sheet looks like this:

Code
-------------------

3. Frequency: Suburbs
Suburb Street Total
Sector 1
Basia Scukum 1
Wellington Sk 1
subtotal
Sector 2
Davie Kannerie 1
Kuyler Lamini 2
subtotal
Sector 3
Overaim Fouche 1
subtotal

-------------------


The code I have in VBA is as follows and for some reason gives me th
wrong value in the third sector:

Code
-------------------

Sheet11.Activate
Range("A14").Select
Do While ActiveCell.Value < "Total"
If ActiveCell.Value < "" Then
ActiveCell.Offset(1, 0).Activate
Else
ActiveCell.Offset(0, 2).Select
ActiveCell.Font.Bold = True

ActiveWorkbook.Names.Add Name:="startsum", RefersTo:=ActiveCell

Range(ActiveCell, ActiveCell.Offset(-1, 0).End(xlUp)).Select ' I'm thinking that my problem is here with the selection of the cells to total.
Range("startsum").Value = Application.Sum(Selection)
Range("startsum").Select
ActiveCell.Offset(0, -2).Select
ActiveCell.Offset(1, 0).Activate

End If
Loo
-------------------

--
popp
-----------------------------------------------------------------------
poppy's Profile: http://www.excelforum.com/member.php...fo&userid=1145
View this thread: http://www.excelforum.com/showthread.php?threadid=37677

 
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
"Center across selection" rather than "Merge cells" Elardus Excel Discussion (Misc queries) 10 November 6th 08 02:28 PM
Range or Selection Divided by "1000" Abdul Shakeel Excel Discussion (Misc queries) 4 October 31st 08 02:38 PM
Icon for "Wrap" and for "Centre Across Selection" BeSmart Excel Worksheet Functions 2 November 16th 05 06:44 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


All times are GMT +1. The time now is 05:38 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"