ROUNDUP current date to either 15th or end of the month

Viewed 430

I am getting an "expected array" error on Today = Day(Today()). I have no idea what is wrong.

Dim Thisday As Integer
Dim Montho As Integer
Dim Yearo As Integer
Dim Lday As Integer
Dim last as Integer
last = Cells(Rows.Count, "A").End(xlUp).Row
Thisday = Day(date)
Montho = Month(date)
Yearo = Year(date)
Lday = Day(Application.WorksheetFunction.EoMonth(Date, -1))

Then Column B in excel gets populated with the same date, either the 15th or the last day.

If Thisday <= 15 Then
Range("B2:B" & Last).Value = Montho & "/15/" & Yearo
End If
If Thisday > 15 Then
Range("B2:B" & Last).Value = Montho & "/" & Lday & "/" & Yearo
End If
End Sub

Also not every month ends on the 30th, so how do get the Lday should return the as day of the month.

2 Answers
Related