Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Insert totals after varying rows of data

Hi all

I've been browsing this forum for the better part of today and last
friday, so I know this question has been asked and answered already,
in a variety of ways.

I'm afraid I am at this point still too much of a novice to employ the
solutions I came across.

I often got the feeling that the suggestions given assumed some level
of expertise with Excel/VBA, and I guess I don't have it - yet.

That being said, I'd like to learn how to insert totals on a worksheet
x lines (probably 2) below the last row of data of varying amounts (in
one instance it might be 5 rows, in another 200+) in SOME columns -
e.g. total A,B,E,F, NO TOTAL C,D,,G,H, etc.

The active range for all columns is Row7:Row300. Don't know if that is
a factor but thought I should include it.

Umm...

Ok I think that's all I can think of,

Please help.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Insert totals after varying rows of data

Prodiji, it appears you want to total every other pair of columns, so I
would assume there are an even number of columns. If true, then this should
do what you want....

Sub Totals()
Dim LRow As Long, LCol As Long
Dim i As Integer
Dim rng As Range

LCol = Cells(7, Columns.Count).End(xlToLeft).Column
For i = 1 To LCol
If i Mod 4 = 1 Or i Mod 4 = 2 Then
LRow = Cells(Rows.Count, i).End(xlUp).Row + 2
Set rng = Range(Cells(7, i), Cells(LRow - 2, i))
Cells(LRow, i).Value = Application.Sum(rng)
End If
Next
End Sub

Mike F

"prodeji" wrote in message
oups.com...
Hi all

I've been browsing this forum for the better part of today and last
friday, so I know this question has been asked and answered already,
in a variety of ways.

I'm afraid I am at this point still too much of a novice to employ the
solutions I came across.

I often got the feeling that the suggestions given assumed some level
of expertise with Excel/VBA, and I guess I don't have it - yet.

That being said, I'd like to learn how to insert totals on a worksheet
x lines (probably 2) below the last row of data of varying amounts (in
one instance it might be 5 rows, in another 200+) in SOME columns -
e.g. total A,B,E,F, NO TOTAL C,D,,G,H, etc.

The active range for all columns is Row7:Row300. Don't know if that is
a factor but thought I should include it.

Umm...

Ok I think that's all I can think of,

Please help.

Thanks



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
Sorting and grouping data with varying number or rows Vickie Excel Worksheet Functions 1 January 13th 10 09:01 PM
Sorting rows of data of varying lengths NDBC Excel Discussion (Misc queries) 12 July 4th 09 12:44 PM
copy data from varying slected rows into new spreadsheet standard_guy Excel Discussion (Misc queries) 2 April 6th 08 04:58 PM
Formatting/Totalling Macro with varying rows of data MSteckbeck Excel Discussion (Misc queries) 2 February 5th 08 10:41 PM
Returning varying rows of data through lookup function NewbieNerd Excel Programming 1 August 26th 04 06:07 PM


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