Need a macro that counts from cell A4 until blank column. So lets say the blank column is L4 (11 nonblanks, 1 blank). I need to then offset that by 1 row down and column back so it is K5, I than need to apply that to the formula below and to: lastrow = cells (rows.count, instead of the 1 like it is below i need this to read 11 (because column K is the count of non blank columns = 11). The reason for this is because I have a Pivot table that gets wider and longer at least every month and I need the last column in the pivot table multiplied by $B$1.


Code:
Sub Button1_Click()
Dim lastrow As Long
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
Range("a5").Formula = "= """"K5""" * $b$1"
Range("a5").AutoFill Destination:=Range("a5:a" & lastrow)
End Sub