ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum Column on Array of sheets (https://www.excelbanter.com/excel-programming/352662-sum-column-array-sheets.html)

GregR

Sum Column on Array of sheets
 
I have an array of sheets consisting of 8 sheets (not the only sheets
in the workbook). I want to sum Col "V" of each sheet in the array,
starting in V2:V+lastrow. I also want to perform some formating on the
sum, which should be offset by 2 rows from the last row, in each sheet.
I need help. TIA

Greg


Tom Ogilvy

Sum Column on Array of sheets
 
Dim v as Variant, sh as Worksheet
Dim rng as Range, rng1 as Range
Dim i as Long, dblSum as Double
v = Array("sheet1","Sheet2","Sheet3") ' adjust to suit
for i = lbound(v) to ubound(v)
set sh = worksheets(v(i))
rng = sh.Range(sh.Cells(2,"V"),sh.Cells(rows.count,"V"). End(xlup))
dblsum + Application.Sum(rng)
set rng1 = rng.offset(2,0).Resize(1,1)
rng1.value = dblsum
rng1.NumberFormat = "#,##0.00"
Next

--
Regards,
Tom Ogilvy

"GregR" wrote in message
oups.com...
I have an array of sheets consisting of 8 sheets (not the only sheets
in the workbook). I want to sum Col "V" of each sheet in the array,
starting in V2:V+lastrow. I also want to perform some formating on the
sum, which should be offset by 2 rows from the last row, in each sheet.
I need help. TIA

Greg




GregR

Sum Column on Array of sheets
 
Tom, thanks again. I wasn't even close with this one.

Greg



All times are GMT +1. The time now is 01:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com