![]() |
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 |
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 |
All times are GMT +1. The time now is 04:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com