This may give you a starting point.
Code:
' ----------------------------------------------------------------
' Procedure Name: lastMonth
' Purpose: Given a Date, identify the previous month Start day to End Day
' Procedure Kind: Sub
' Procedure Access: Public
' Author: Jack
' Date: 01-May-23
' ----------------------------------------------------------------
Sub lastMonth()
Dim MyDate(3) As Date
MyDate(0) = #2/25/2023#
MyDate(1) = #3/17/2020#
MyDate(2) = #12/25/2021#
MyDate(3) = #1/1/2000#
Dim i As Integer
For i = LBound(MyDate) To UBound(MyDate)
Debug.Print DateSerial(Year(MyDate(i)), Month(MyDate(i)) - 1, 1) & " thru " & DateSerial(Year(MyDate(i)), Month(MyDate(i)), 0)
Next i
End Sub
Result:
01-Jan-23 thru 31-Jan-23
01-Feb-20 thru 29-Feb-20
01-Nov-21 thru 30-Nov-21
01-Dec-99 thru 31-Dec-99