Hello,
I have a variable number of columns. Column N is where I need the product of Columns L and M. I also have a variable number of rows for Column N to fill.
I have no idea how to even begin to write this.
I have this so far but it doesn't even begin to work.
Dim lngLstCol2 As Long, lngLstRow2 As Long
lngLstRow2 = ActiveSheet.UsedRange.Rows.Count
lngLstCol2 = ActiveSheet.UsedRange.Columns.Count
For Each rngCell2 In Range(lngLstRow2)
If rngCell2.Value > "" Then
r2 = rngCell2.Row
C2 = rngCell2.Column
Range(Cells(r2, C2), Cells(r2, lngLstCol2)).Select
With Selection
.Formula = "=PRODUCT(lngLstCol2-2, lngLstCol2-1)"
End With
End If
Next
Any help at all would be appreciated.
I have a variable number of columns. Column N is where I need the product of Columns L and M. I also have a variable number of rows for Column N to fill.
I have no idea how to even begin to write this.
I have this so far but it doesn't even begin to work.
Dim lngLstCol2 As Long, lngLstRow2 As Long
lngLstRow2 = ActiveSheet.UsedRange.Rows.Count
lngLstCol2 = ActiveSheet.UsedRange.Columns.Count
For Each rngCell2 In Range(lngLstRow2)
If rngCell2.Value > "" Then
r2 = rngCell2.Row
C2 = rngCell2.Column
Range(Cells(r2, C2), Cells(r2, lngLstCol2)).Select
With Selection
.Formula = "=PRODUCT(lngLstCol2-2, lngLstCol2-1)"
End With
End If
Next
Any help at all would be appreciated.