ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code causes a problem (https://www.excelbanter.com/excel-programming/434538-code-causes-problem.html)

Patrick C. Simonds

Code causes a problem
 
I am totally stumped here. My code below crashes Excel and I can not
figure out why. To be more specific it is only the next to last line that
causes the problem (if I remove it I have no problem), and more
interestingly, it is only after you close Excel and restart that I have the
problem. Is there something that I am missing




If rMyCount < 2 Then
Frame1001.Visible = False
End If

If rMyCount < 3 Then
Frame2001.Visible = False
End If

If rMyCount < 4 Then
Frame3001.Visible = False
End If

If rMyCount < 5 Then
Frame4001.Visible = False
End If

If rMyCount < 6 Then
Frame5001.Visible = False
End If

If rMyCount < 7 Then
Frame6001.Visible = False
End If

If rMyCount < 8 Then
Frame7001.Visible = False
End If

If rMyCount < 9 Then
Frame8001.Visible = False
End If

If rMyCount < 10 Then
Frame9001.Visible = True
End If


JLGWhiz[_2_]

Code causes a problem
 
As a stand alone statement, it should not be a problem. But it could cause
a problem if elsewhere in the code there is something that conflicts with
the logic of it.



"Patrick C. Simonds" wrote in message
...
I am totally stumped here. My code below crashes Excel and I can not
figure out why. To be more specific it is only the next to last line that
causes the problem (if I remove it I have no problem), and more
interestingly, it is only after you close Excel and restart that I have
the problem. Is there something that I am missing




If rMyCount < 2 Then
Frame1001.Visible = False
End If

If rMyCount < 3 Then
Frame2001.Visible = False
End If

If rMyCount < 4 Then
Frame3001.Visible = False
End If

If rMyCount < 5 Then
Frame4001.Visible = False
End If

If rMyCount < 6 Then
Frame5001.Visible = False
End If

If rMyCount < 7 Then
Frame6001.Visible = False
End If

If rMyCount < 8 Then
Frame7001.Visible = False
End If

If rMyCount < 9 Then
Frame8001.Visible = False
End If

If rMyCount < 10 Then
Frame9001.Visible = True
End If





All times are GMT +1. The time now is 05:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com