VBA スクリプトで、日付と時刻を変更する必要があります。つまり、日を増減し、条件に応じて時刻を午前 8 時または午後 8 時に設定します。
ここに関連するコードセグメントがあります-
宣言された変数 -
' To reference the cell having the source date
Dim d As String
' To reference the cell where the modified date is written
Dim destCell As String
' Some cell that contains 1 or 0
Dim somecell As String
'If condition and value assignment
If Range(somecell).Value = 1 Then
Range(destCell).Value = DATE(YEAR(Range(d)),MONTH(Range(d)),DAY(Range(d)-1))+TIME(8,0,0)
質問: 私が行ったことは、条件が満たされたときに、日を減らし、時刻を午前 8 時に設定することです。構文エラーが発生します。助けてください。