Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Inserting a SUM Function

I need to add a sum formula to some cells on a sheet.

this code fills the ceels that I need to total:

mRow = 4
With Sheets("Street Summary")
For nStreet = 1 To streetNum
.Cells(mRow, 1).Value = streetStats(nStreet, 1)
.Cells(mRow, 2).Value = streetStats(nStreet, 2)
.Cells(mRow, 3).Value = streetStats(nStreet, 3)
.Cells(mRow, 4).Value = streetStats(nStreet, 4)
.Cells(mRow, 5).Value = streetStats(nStreet, 5)
mRow = mRow + 1
Next nStreet
End With


I need to total each of the columns from column 2 thru 5 (Column 1 is a text
label).

So in cell ( row = mRow, col = 2) I need to generate a formula that will
total cells (row = 4, col =2) thru cells (row = 4 + streetNum, Col = 2).

I hope I explained this weel enbough to get som ehelp.

Thanks,
Ken Looms


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting a SUM Function


Would having vba calculate the sum and place it in the right cell work?
if so this would be easy - although I don't know exactly how to do it
off hand without fooling around a little.


--
duane


------------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...o&userid=11624
View this thread: http://www.excelforum.com/showthread...hreadid=268385

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Inserting a SUM Function

Thanks, Duane. Yeah, that would have worked. I don't know why I got so
focused on doing a sum formula.

But I did figure that out.

The code looks like this:

mRow = mRow - 1

.Cells(mRow + 1, 1).Value = "Total"
.Cells(mRow + 1, 1).HorizontalAlignment = xlRight
.Cells(mRow + 1, 1).Font.Bold = True
.Cells(mRow + 1, 2).Formula = "=sum(B4:B" & mRow & ")"
.Cells(mRow + 1, 3).Formula = "=sum(C4:C" & mRow & ")"
.Cells(mRow + 1, 4).Formula = "=sum(D4:D" & mRow & ")"
.Cells(mRow + 1, 5).Formula = "=sum(E4:E" & mRow & ")"
.Cells(mRow + 1, 6).Formula = "=sum(F4:F" & mRow & ")"



Thanks for the post.

Ken Loomis


"duane" wrote in message
...

Would having vba calculate the sum and place it in the right cell work?
if so this would be easy - although I don't know exactly how to do it
off hand without fooling around a little.


--
duane


------------------------------------------------------------------------
duane's Profile:
http://www.excelforum.com/member.php...o&userid=11624
View this thread: http://www.excelforum.com/showthread...hreadid=268385



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
Inserting Symbols with IF Function. GEM Excel Discussion (Misc queries) 5 July 24th 09 03:55 PM
Inserting dates function ArthurN Excel Worksheet Functions 4 January 11th 09 02:37 PM
Inserting a function into a worksheet Rich D Excel Discussion (Misc queries) 1 February 9th 07 05:36 PM
Inserting an AutoDate Function MissTrish New Users to Excel 1 May 26th 05 06:02 PM
Copy an IF function when Inserting new row Philobr Excel Discussion (Misc queries) 1 December 3rd 04 10:45 AM


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