PDA

View Full Version : summ row with range



sal21
01-04-2008, 01:54 PM
is possible to add total in column N for each orizzontal range do until last cell in column A is filled?

Example:
summing range B5:M5 put total in cell in column N
summing range B6:M6 put total in cell in column N
...
summing range B69:M69 put total in cell in column N

In this case the column of total is N but the sheet is dinamic...
To intercept the column where the total is stored find "TOT" in line 4

Bob Phillips
01-04-2008, 02:22 PM
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim LastRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
Range("N5").Resize(LastRow - 4).Formula = "=SUM(B5:M5)"
End With
End Sub

stanleydgrom
01-05-2008, 08:58 AM
sal21,

Here you go - see the attached workbook "Cartel1 - sal21 - 20080104.xls".

I added a Worksheet_Change Event that will monitor column A. Each time you add an entry in column A, field title "UFF. AG.", the formulas in column N will be updated, and the formula in cell N3 will be updated dynamically.

Have a great day,
Stan