Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Help with totaling a columns in VBA

I have some code that I have built. (may not be completely effecient yet)
However, I have a spread sheet that the data starts in cell H9 that I want to
maneuver.

The purpose of the code is to create a row to populate a total for each
column. I used this forum to grab the code: (Cells(Rows.Count,
"h").End(xlUp)(2).FormulaR1C1 = "=Sum(R10C:R[-1]C)") however, this places
the total at the bottom of the column. How would I state where I want the
total to be placed? Secondly. The spread sheet comes with totals on the
bottom that are not in a usable format. I would like to be able to
incorporate a code that finds that row of data and deletes it.

My sample code is below: Here is a same of table data:

Fcst 200521 200522
1 1,713.99 1,629.17
2 2,047.80 1,946.41
Total Blank 1,100.61 1,046.07 <= This row to be deleted.
Row number would not be constant.




Rows("9:9").Select
Selection.Insert Shift:=xlDown
Range("D9").Select
ActiveCell.FormulaR1C1 = "Total"
Cells(Rows.Count, "h").End(xlUp)(2).FormulaR1C1 = "=Sum(R10C:R[-1]C)"
Range("H9").Select
Selection.Copy
Range("I9:BH9").Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Range("H9").Select
Selection.End(xlDown).Select
Range("I36:BI36").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select

Thanks for any help.
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default Help with totaling a columns in VBA

Nevermind this post. I used a different method.

"Chris" wrote:

I have some code that I have built. (may not be completely effecient yet)
However, I have a spread sheet that the data starts in cell H9 that I want to
maneuver.

The purpose of the code is to create a row to populate a total for each
column. I used this forum to grab the code: (Cells(Rows.Count,
"h").End(xlUp)(2).FormulaR1C1 = "=Sum(R10C:R[-1]C)") however, this places
the total at the bottom of the column. How would I state where I want the
total to be placed? Secondly. The spread sheet comes with totals on the
bottom that are not in a usable format. I would like to be able to
incorporate a code that finds that row of data and deletes it.

My sample code is below: Here is a same of table data:

Fcst 200521 200522
1 1,713.99 1,629.17
2 2,047.80 1,946.41
Total Blank 1,100.61 1,046.07 <= This row to be deleted.
Row number would not be constant.




Rows("9:9").Select
Selection.Insert Shift:=xlDown
Range("D9").Select
ActiveCell.FormulaR1C1 = "Total"
Cells(Rows.Count, "h").End(xlUp)(2).FormulaR1C1 = "=Sum(R10C:R[-1]C)"
Range("H9").Select
Selection.Copy
Range("I9:BH9").Select
Selection.PasteSpecial Paste:=xlFormulas, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Range("H9").Select
Selection.End(xlDown).Select
Range("I36:BI36").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select

Thanks for any help.
End Sub

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
Totaling columns John Excel Worksheet Functions 4 June 6th 10 03:15 AM
sorting and sub totaling columns dmills Excel Discussion (Misc queries) 2 February 12th 09 08:11 PM
Columns not totaling unless you save worksheet Lori G Excel Discussion (Misc queries) 3 January 7th 08 06:54 PM
Totaling criteria from 2 columns alexy Excel Worksheet Functions 13 August 4th 05 03:12 PM
Totaling Columns DNA Excel Discussion (Misc queries) 1 May 5th 05 01:40 PM


All times are GMT +1. The time now is 08:24 AM.

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"