標題: [發問] IF AND OR 如何適用? [打印本頁] 作者: Lin-excel 時間: 2019-4-8 11:01 標題: IF AND OR 如何適用?
若想用VBA 的IF句法,來判斷每季財報自動更新,該如何寫?
If .Cells(r, "EN") = "" Or (Date >= DateSerial(Year(Date), 3, 31) And Date < DateSerial(Year(Date), 4, 1)) Or (Date >= DateSerial(Year(Date), 5, 14) And Date < DateSerial(Year(Date), 5, 16)) Or (Date >= DateSerial(Year(Date), 8, 14) And Date < DateSerial(Year(Date), 8, 16)) Or (Date >= DateSerial(Year(Date), 11, 14) And Date < DateSerial(Year(Date), 11, 16)) Then Exit Sub
出現程式物件定義錯誤,請前輩高手指正!作者: ML089 時間: 2019-4-9 10:40
Y = Year(Date)
If .Cells(r, "EN") = "" Then Exit Sub
If Date >= DateSerial(Y, 3, 31) And Date < DateSerial(Y, 4, 1) Then Exit Sub
If Date >= DateSerial(Y, 5, 14) And Date < DateSerial(Y, 5, 16) Then Exit Sub
If Date >= DateSerial(Y, 8, 14) And Date < DateSerial(Y, 8, 16) Then Exit Sub
If Date >= DateSerial(Y, 11, 14) And Date < DateSerial(Y, 11, 16) Then Exit Sub作者: Lin-excel 時間: 2019-4-9 11:07