teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

再度ミスを見つけたので変更しました

2021/02/11 21:43

投稿

tassan
tassan

スコア1

title CHANGED
File without changes
body CHANGED
@@ -20,7 +20,7 @@
20
20
  for i = 4 To Cells(Rows.Count, 1).End(xlUp).Row
21
21
  for j = 8 To 15
22
22
  Set mycell = Cells(i, j)
23
- If 30 <= DateDiff("d", mycell, Date) And mycell <> '' Then
23
+ If 30 <= DateDiff("d", mycell, Date) And mycell <> "" Then
24
24
 
25
25
  Range(Cells(i,3),Cells(i,7)).Interior.Color = RGB(255,0,0)
26
26
 

2

申し訳ございません。該当コードのd”箇所に関してソースを確認したところ問題なかったので、直接teratailに打ち込んだことが原因です。実際のエラーの原因ではないとおもいます

2021/02/11 21:43

投稿

tassan
tassan

スコア1

title CHANGED
@@ -1,1 +1,1 @@
1
- VBAのコードにつて質問です
1
+ VBAのエラーコード13を解決したいです
body CHANGED
@@ -20,18 +20,18 @@
20
20
  for i = 4 To Cells(Rows.Count, 1).End(xlUp).Row
21
21
  for j = 8 To 15
22
22
  Set mycell = Cells(i, j)
23
- If 30 <= DateDiff('d, mycell, Date) And mycell <> '' Then
23
+ If 30 <= DateDiff("d", mycell, Date) And mycell <> '' Then
24
24
 
25
25
  Range(Cells(i,3),Cells(i,7)).Interior.Color = RGB(255,0,0)
26
26
 
27
- Elseif 14 <= DateDiff('d', mycell, Date) And mycell <> "" Then
27
+ Elseif 14 <= DateDiff("d", mycell, Date) And mycell <> "" Then
28
28
  Range(Cells(i,3),Cells(i,7).Interior.Color = RGB(255,255,0)
29
29
 
30
- Elseif 7 <= DateDiff('d', mycell, Date) And mycell <> "" Then
30
+ Elseif 7 <= DateDiff("d", mycell, Date) And mycell <> "" Then
31
31
 
32
32
  Range(Cells(i,3),Cells(i,7).Interior.Color = RGB(0,255,255)
33
33
 
34
- Elseif 7 > DateDiff('d', mycell, Date) Then
34
+ Elseif 7 > DateDiff("d", mycell, Date) Then
35
35
 
36
36
  Range(Cells(i,3),Cells(i,7).Interior.Color = RGB(255,255,255)
37
37
 

1

指摘された文法の間違いについて、ソースをコピペではなく手打ちで入力したミスであったため、指摘された箇所を修正しました

2021/02/11 21:38

投稿

tassan
tassan

スコア1

title CHANGED
File without changes
body CHANGED
@@ -17,12 +17,12 @@
17
17
  Dim i As Long
18
18
  Dim j As long
19
19
  Dim mycell As Range
20
- for i = 4 To Cells(Rows.Count. 1).End(xlUp).Row
20
+ for i = 4 To Cells(Rows.Count, 1).End(xlUp).Row
21
21
  for j = 8 To 15
22
22
  Set mycell = Cells(i, j)
23
23
  If 30 <= DateDiff('d, mycell, Date) And mycell <> '' Then
24
24
 
25
- Range(Cells(i,3),Cells(i,7).Interior.Color = RGB(255,0,0)
25
+ Range(Cells(i,3),Cells(i,7)).Interior.Color = RGB(255,0,0)
26
26
 
27
27
  Elseif 14 <= DateDiff('d', mycell, Date) And mycell <> "" Then
28
28
  Range(Cells(i,3),Cells(i,7).Interior.Color = RGB(255,255,0)