If else if else statement help
Thank you, I had a play around with your suggestions and they helped a lot.
"NickHK" wrote:
Not sure what you are trying to do.
"Worksheets("Calc Current PL").Range("K5").Value" will = 0 or it will not.
So I do not see the relevance of Range("K41").Value .
Do you mean this ?
With Worksheets("Calc Current PL")
If .Range("K5").Value = 0 Then
Call HideZerosFromCurrentChart1
Else
Call ReverseHideZerosFromCurrent1
End If
If .Range("K41").Value = 0 Then
Call HideZerosFromCurrentChart6
Else
Call ReverseHideZerosFromCurrent6
End If
'...etc
Also, I don't know what the subs like "HideZerosFromCurrentChart6", but
could you simplify it by passing some arguments to a single routine. e.g.
Function FormatZerosFromChart(argShow As Boolean, argChart As Long)
'whatever code here
End Function
Then you could process each cell value with
With Worksheets("Calc Current PL")
Call FormatZerosFromChart((.Range("K5").Value = 0),1)
Call FormatZerosFromChart((.Range("K41").Value = 0),6)
'.....etc
NickHK
"Wahine" wrote in message
...
Hi, Please help I have the following if else if else statement which
describes exactly what I want to do, but the syntax or order is not
correct.
If Worksheets("Calc Current PL").Range("K5").Value = 0 Then
Call HideZerosFromCurrentChart1
Else
Call ReverseHideZerosFromCurrent1
ElseIf Worksheets("Calc Current PL").Range("K41").Value = 0
Then
Call HideZerosFromCurrentChart6
Else
Call ReverseHideZerosFromCurrent6
ElseIf Worksheets("Calc Current PL").Range("K77").Value = 0
Then
Call HideZerosFromCurrentChart7
Else
Call ReverseHideZerosFromCurrent7
ElseIf Worksheets("Calc Current PL").Range("K113").Value = 0
Then
Call HideZerosFromCurrentChart8
Else
Call ReverseHideZerosFromCurrent8
End If
Thank you in advance for help
|