Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
Please consider this code found in one of my worksheet (ws_form) module, in particular the code in blue.
Consider this example:
segtar is a range with address $R$31
rwend = 27
ws_form = worksheets("Form"), the module in which this code resides
I am unable to get the code to recognize the IF criteria of the blue code ...
If the segtar address = .Range("R" & rwend + 4) .... R31 = .range then proceed with that code...
R31 = .range("R31")
This is true, but it skips right over that IF as if it were false.
Thoughts?
Consider this example:
segtar is a range with address $R$31
rwend = 27
ws_form = worksheets("Form"), the module in which this code resides
I am unable to get the code to recognize the IF criteria of the blue code ...
If the segtar address = .Range("R" & rwend + 4) .... R31 = .range then proceed with that code...
R31 = .range("R31")
This is true, but it skips right over that IF as if it were false.
Thoughts?
Rich (BB code):
If Not Intersect(Target, .Range("R" & rwend + 3 & ":R" & rwend + 7)) Is Nothing Then
.Unprotect
'unselected to selected state
If segtar.Cells.Interior.ColorIndex = xlNone Then
Stop
segtar.Cells.Interior.Color = ccgreen
optn = segtar.Offset(, 1)
cntoperations = cntoperations + 1
If segtar.Address = .Range("R" & rwend + 3) Then 'full plow
If .Range("R" & rwend + 4).Interior.Color = ccgreen Then 'SPOT PLOW
.Range("R" & rwend + 4).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 6).Interior.Color = ccgreen Then 'FULL BLOW
.Range("R" & rwend + 6).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 7).Interior.Color = ccgreen Then 'SPOT BLOW
.Range("R" & rwend + 7).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 8).Interior.Color = ccgreen Then 'WIDEN BLOWER
.Range("R" & rwend + 8).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("AB" & rwend + 3).Interior.Color = ccgreen Then 'PATROL
.Range("AB" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
ElseIf segtar.Address = .Range("R" & rwend + 4) Then 'spot plow
If .Range("R" & rwend + 3).Interior.Color = ccgreen Then 'FULL PLOW
.Range("R" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 6).Interior.Color = ccgreen Then 'FULL BLOW
.Range("R" & rwend + 6).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 7).Interior.Color = ccgreen Then 'SPOT BLOW
.Range("R" & rwend + 7).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 8).Interior.Color = ccgreen Then 'WIDEN BLOWER
.Range("R" & rwend + 8).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("AB" & rwend + 3).Interior.Color = ccgreen Then 'PATROL
.Range("AB" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
ElseIf segtar.Address = .Range("R" & rwend + 5) Then 'widen - plow
If .Range("R" & rwend + 6).Interior.Color = ccgreen Then 'FULL BLOW
.Range("R" & rwend + 6).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 7).Interior.Color = ccgreen Then 'SPOT BLOW
.Range("R" & rwend + 7).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 8).Interior.Color = ccgreen Then 'WIDEN BLOWER
.Range("R" & rwend + 8).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("AB" & rwend + 3).Interior.Color = ccgreen Then 'PATROL
.Range("AB" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
ElseIf segtar.Address = .Range("R" & rwend + 6) Then 'full blow
If .Range("R" & rwend + 3).Interior.Color = ccgreen Then 'full plow
.Range("R" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 4).Interior.Color = ccgreen Then 'spot plow
.Range("R" & rwend + 4).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 5).Interior.Color = ccgreen Then 'widen plow
.Range("R" & rwend + 5).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 7).Interior.Color = ccgreen Then 'spot blow
.Range("R" & rwend + 7).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("AB" & rwend + 3).Interior.Color = ccgreen Then 'PATROL
.Range("AB" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
ElseIf segtar.Address = .Range("R" & rwend + 7) Then 'spot blow
If .Range("R" & rwend + 3).Interior.Color = ccgreen Then 'full plow
.Range("R" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 4).Interior.Color = ccgreen Then 'spot plow
.Range("R" & rwend + 4).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 5).Interior.Color = ccgreen Then 'widen plow
.Range("R" & rwend + 5).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 6).Interior.Color = ccgreen Then 'full blow
.Range("R" & rwend + 6).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("AB" & rwend + 3).Interior.Color = ccgreen Then 'PATROL
.Range("AB" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
ElseIf segtar.Address = .Range("R" & rwend + 8) Then 'widen blower
If .Range("R" & rwend + 3).Interior.Color = ccgreen Then 'full plow
.Range("R" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 4).Interior.Color = ccgreen Then 'spot plow
.Range("R" & rwend + 4).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("R" & rwend + 5).Interior.Color = ccgreen Then 'widen plow
.Range("R" & rwend + 5).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
If .Range("AB" & rwend + 3).Interior.Color = ccgreen Then 'PATROL
.Range("AB" & rwend + 3).Interior.ColorIndex = xlNone
cntoperations = cntoperations - 1
End If
End If
opcode optn
sequence2
RemoveCellSelectionBox
'selected to unselected state
Else
Target.Interior.ColorIndex = xlNone
optn = segtar.Offset(, 1)
cntoperations = cntoperations - 1
opcode optn
sequence10
RemoveCellSelectionBox
End If
MsgBox "Surface Conditions: " & cntconditions & Chr(13) & "Operations: " & cntoperations
If cntconditions > 0 And cntoperations > 0 Then
.Shapes("btn_sendhome").Visible = True
Else
.Shapes("btn_sendhome").Visible = False
End If
.Protect
End If