BPW
New Member
- Joined
- Mar 7, 2013
- Messages
- 31
- Office Version
- 365
- Platform
- Windows
There is a small project I have been working on and I have ran into a problem that has been quite vexing. In short, I'm attempting to populate a cell a row below the first blank row with a Subtotal formula. The below code works and populates the correct formula in the location desired but the result is zero which clearly isn't the case as the formula's range has many numbers (formatted as numbers.)
Any ideas? Let me know if you need more info.
PS: I've very much a beginner with VBA for Excel.
Any ideas? Let me know if you need more info.
PS: I've very much a beginner with VBA for Excel.
VBA Code:
Sub BPM_SUBTOTAL()
Dim ws As Worksheet
Set ws = Sheets("Sku Data")
Dim TrendRow As Long
Dim LastRowCount As Integer
LastRowCount = ActiveSheet.UsedRange.Rows.Count
TrendRow = Range("A2").End(xlDown).Offset(2, 24).Select
With ActiveCell
.NumberFormat = "General"
.Formula = "=SUBTOTAL(9,Y3:Y" & LastRowCount & ")"
End With
End Sub