A = Range("a3").CurrentRegion.Rows.Count
Dim N As Variant, O As Variant, P As Variant, Q As Variant
For i = 1 To A
N = Range("N" & i + 2)
O = Range("O" & i + 2)
P = Range("P" & i + 2)
Q = Range("Q" & i + 2)
If N >= 156 < 156.5 And O >= 156 < 156.5 And P >= 156 < 156.5 And Q >= 156 < 156.5 Then
Range("bq" & i + 2) = "尺寸合規"
ElseIf N < 156 >= 156.5 And O < 156 >= 156.5 And P < 156 >= 156.5 And Q < 156 >= 156.5 Then
Range("bq" & i + 2) = "尺寸不合規"
End If
Next i
跑不出來結果
請各位達人幫幫忙了
謝謝作者: mark15jill 時間: 2015-8-7 16:49
這樣可以嗎?
If N >= 156 and N< 156.5 And O >= 156 and O < 156.5 And P >= 156 and P < 156.5 And Q >= 156 and Q < 156.5 Then
Range("bq" & i + 2) = "尺寸合規"
ElseIf N < 156 or N>= 156.5 or O < 156 or O >= 156.5 or P < 156 or P >= 156.5 or Q < 156 or Q >= 156.5 Then
Range("bq" & i + 2) = "尺寸不合規"
End If作者: 52ee24 時間: 2015-8-10 16:26
謝謝各位大德的幫忙
把它改成如下就可以用了
謝謝喔
Dim N As Variant, O As Variant, P As Variant, Q As Variant
For i = 1 To A
N = Range("N" & i + 2)
O = Range("O" & i + 2)
P = Range("P" & i + 2)
Q = Range("Q" & i + 2)
If N >= 156 And N < 156.5 And O >= 156 And O < 156.5 And P >= 156 And P < 156.5 And Q >= 156 And Q < 156.5 Then
Range("bq" & i + 2) = "尺寸合規"
ElseIf N < 156 Or N >= 156.5 And O < 156 Or O >= 156.5 And P < 156 Or P >= 156.5 And Q < 156 Or Q >= 156.5 Then
Range("bq" & i + 2) = "尺寸不合規"
End If
Next i