Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Part way there.
Twelve groups of 4 columns with a blank column between each group and a two column group at the end. Each column in each group will have the same number of rows and that number will change often. Each group will have a different number of rows from the other groups but again always the same number of rows within the group. The code below puts the sum formula properly at the end of each column and in each group (except the two column group which I will probably write a separate line bit code to take care of them). The LastRow is giving me fits as I need it to refer to each group as the For iI loop does it looping. Second major problem is getting the formula to refer to proper columns as it loops. As it is, it refers only to the first group. The commented out LastRow works but only refers to the first group. Thanks, Howard Sub SumMyCols() Dim i As Long Dim LastRow As Long, myCol As Long, iI As Long Dim sumRng As Range '("AB:AE, AG:AJ, AL:AO, AQ:AT, AV:AY, BA:BD, BF:BI, BK:BN, BP:BS, BU:BX, BZ:CC, CE:CH, CJ:CK") 'LastRow = Range("AB:AE").Find(What:="*", after:=[ab8], _ searchorder:=xlByRows, _ searchdirection:=xlPrevious).Row ' MsgBox LastRow For iI = 28 To 86 LastRow = Range(Cells(9, iI)).Find(What:="*", after:=Range(Cells(8, iI)), _ searchorder:=xlByRows, _ searchdirection:=xlPrevious).Row Cells(LastRow + 2, iI).Resize(1, 4) = Application.WorksheetFunction.Sum(Range("AB9:AB" & LastRow)) iI = iI + 4 Next 'iI End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop returns only one value, does not loop & an assignment to columnhow-to problem. | Excel Programming | |||
Permanently link formula references to Column Names and not Column Cell Numbers | Excel Discussion (Misc queries) | |||
how to change column references, while filling down another column | Excel Discussion (Misc queries) | |||
column loop problem?? | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming |