![]() |
Sum of Variable Cells in a Column
Hi,
How to sum a variable no of cells in a column using VBA, I want the code to sum up the cells on a certain condition of other cells such as IF(D10=""), then add up all cells between N1 and N9, and so on IF D16="", then add up all cells from N11 up to N15. Can anybody help? Regards. |
Sum of Variable Cells in a Column
if Range("D10").Value = "" then
mysum = Application.Sum(range("N1:N9")) elseif Range("D16").Value = "" then mysum = Application.Sum(range("N11:N15")) else mysum = 0 End if -- Regards, Tom Ogilvy "IJQ" wrote in message ... Hi, How to sum a variable no of cells in a column using VBA, I want the code to sum up the cells on a certain condition of other cells such as IF(D10=""), then add up all cells between N1 and N9, and so on IF D16="", then add up all cells from N11 up to N15. Can anybody help? Regards. |
All times are GMT +1. The time now is 05:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com