1
它僅返回星期六,因爲日期很簡單,因爲我只需要添加一個加1,但是如何讓它從1到7循環?還怎麼換了個名字,以及查找具有for循環的月份名稱
Sub netprofit()
Dim dates As Date
Dim count As Integer
Dim olweekdayname As String
olweekdayname = WeekdayName(Weekday(dates))
dates = DateSerial(2014, 9, 1)
For count = 2 To 366
Select Case Weekday(dates)
Case 1, 7
Range("B" & count) = 0
Range("C" & count) = 0
Range("D" & count) = 0
Range("E" & count) = olweekdayname
Case Else
Range("C" & count) = Int((100 - 0 + 1) * Rnd + 0)
Range("D" & count) = Range("B" & count) - Range("C" & count)
Range("A" & count) = dates
Range("E" & count) = olweekdayname
End Select
dates = dates + 1
Next
End Sub
它不會阻止它從週六上市的星期六。 – marvellosity123