msquared99
05-06-2015, 12:08 PM
OK, I know this is simple but I am not getting it.
All I want to do is sum the data in column H on the WSIC worksheet in the WSCS worksheet.
So cell B3 in the WSCS will have a formula in it and not a value.
Sub Macro1()
Dim WSIC As Worksheet, WSM3 As Worksheet, WSCS As Worksheet
Dim LastRow As Long
Set WSIC = Worksheets("IC")
Set WSM3 = Worksheets("M3")
Set WSCS = Worksheets("Commission Summary")
With WSIC
LastRow = Cells(.Cells.Rows.Count, "H").End(xlUp).Row - 1
End With
With WSCS
.Range("B3") = "=sum(H2:H" & LastRow & ")"
'=== I want this line of code to sum column H on WSIC
End With
MsgBox LastRow
End Sub
Thanks for your help.
All I want to do is sum the data in column H on the WSIC worksheet in the WSCS worksheet.
So cell B3 in the WSCS will have a formula in it and not a value.
Sub Macro1()
Dim WSIC As Worksheet, WSM3 As Worksheet, WSCS As Worksheet
Dim LastRow As Long
Set WSIC = Worksheets("IC")
Set WSM3 = Worksheets("M3")
Set WSCS = Worksheets("Commission Summary")
With WSIC
LastRow = Cells(.Cells.Rows.Count, "H").End(xlUp).Row - 1
End With
With WSCS
.Range("B3") = "=sum(H2:H" & LastRow & ")"
'=== I want this line of code to sum column H on WSIC
End With
MsgBox LastRow
End Sub
Thanks for your help.