Hi Everyone,
Brain struggling with this one and not sure if it's possible.
I want to detect the current month/year and just extend the table in spanning columns A-G downwards to this month.
Cells in column B, C, D, E, F & G have a formula that just copies down automatically then.
Screenshot 2019-02-11 at 19.20.31.png
I found this code online and adjusted it slightly but it goes beyond this month, into 2021 and I only want it to go to this month (not sure if it's a serial thing or?) (That's if I enter 1 as the month and the year as 2019 in the popup entry box, that is).
Sub test_row()
Dim Sht As Worksheet
Dim m As Integer, y As Integer, DaysInMonth As Integer
m = InputBox("What month is this? 9=september?")
y = InputBox("What year is this?, 2014?") ' if you are using 2014 only, then just type in 2014 here
DaysInMonth = DateSerial(y, m + 1, 1) - DateSerial(y, m, 1)
Set Sht = Sheets("FI")
LastRow = Sht.Cells(Rows.Count, 1).End(xlUp).Row
LR1 = LastRow + DaysInMonth
Range("A" & LastRow & ":G" & LastRow).Select
Selection.AutoFill Destination:=Range("A" & LastRow & ":" & LR1), Type:=xlFillDefault
End Sub
Is it possible to do this?
Any help greatly appreciated, brain throbbing.
All the best,
Paul
Bookmarks