Combining VBA code for columns
First off....I changed the code to a For Loop. Here is what I have
now:
Range("I8").Select
Set rng = Range(ActiveCell.Address)
For Count = 0 To i
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value < "" Then
l = ActiveCell.Value + l
Else
rng.Activate
ActiveCell.Value = l
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Set rng = Range(ActiveCell.Address)
l = 0
End If
Next Count
I have Parent and NonParent Values in a spreadsheet. The Parents sit
on top of the NonParents. What the code does is it stores the values
of the non-parents in a variable and then goes to the parents cell
address and pastes that value. Then it moves on to the next parent
value. (Every parent value is a blank cell to begin with.)
Essentially it is a subtotal in reverse order. I am trying to total
all of the nonparent values in put them in the parent cell above.
Example:
Parent - COSTCO
<This cell is blank
NonParent - COSTCO 124 A. St. Boston, MA
500
NonParent - COSTCO 45 Fish St. New York, NY
600
What the code does is it totals to 1100 and stores it in the variable
(l in code above) then goes to the parent cell and pastes that value.
It finds the next parent cell by jumping to the next blank cell and
clearing the variable l.
Hope this makes sense. Open to all suggestions.
Also...I select EVERYTHING. It is the only way I can visualize the
code. Is there a quick tutorial on "How to get away from selecting
cells"?
Thanks!!!
Chris
|