ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Sum Non-Contiguous Columns (https://www.excelbanter.com/excel-programming/386466-vba-sum-non-contiguous-columns.html)

Exceller

VBA Sum Non-Contiguous Columns
 
I'm looking for VBA code to sum columns P and R in column S (sheet 1).
So, cell P2 and R2 will be summed in S2; P3 and R3 summed in S3, and so on.
Thanks!
Exceller

Don Guillett

VBA Sum Non-Contiguous Columns
 
Set frng = Range("s2:s" & Cells(Rows.count, "s").End(xlUp).Row)
With frng
.Formula = "=p2+r2"
'uncomment next line to eliminate the formula
' .Formula = .Value
End With

--
Don Guillett
SalesAid Software

"Exceller" wrote in message
...
I'm looking for VBA code to sum columns P and R in column S (sheet 1).
So, cell P2 and R2 will be summed in S2; P3 and R3 summed in S3, and so
on.
Thanks!
Exceller




Exceller

VBA Sum Non-Contiguous Columns
 
Thanks, Don. I appreciate your help.
Exceller

"Don Guillett" wrote:

Set frng = Range("s2:s" & Cells(Rows.count, "s").End(xlUp).Row)
With frng
.Formula = "=p2+r2"
'uncomment next line to eliminate the formula
' .Formula = .Value
End With

--
Don Guillett
SalesAid Software

"Exceller" wrote in message
...
I'm looking for VBA code to sum columns P and R in column S (sheet 1).
So, cell P2 and R2 will be summed in S2; P3 and R3 summed in S3, and so
on.
Thanks!
Exceller






All times are GMT +1. The time now is 05:24 PM.

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