我在Today = Day(Today())上收到「expected array」錯誤。我不知道什麼是錯的。ROUNDUP當前日期爲15日或月末
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))
然後在excel中的列B會被填入相同的日期,無論是第15天還是最後一天。
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
也不是每個月都在30日結束,那麼Lday應該如何返回月份的日期。
還是想出了相同的錯誤消息。 –
對不起 - 我的錯誤:斯科特有它 –