Reasons why code might unexpectedly end itself?

111StepsAhead

New Member
Joined
Jun 3, 2011
Messages
2
Hello MrExcel.com,

I have recently worked with some code (70% or so my own making) and am finding out that when I add a specific line to a Do While Loop the code will refuse to go past that line.

Code:
    Dim Opes() As String
    Dim iCount As Integer
    Dim Max As Integer
    Dim UserOption As Integer
    Dim What_Button As Integer
    Dim My_Sheet As String
    Dim Last_Cell As String
    Dim rng As Range
    
    Select Case Click_Event
        Case 1
            Max = Worksheets("Mode_Tracker_0001").Range(Column & 65536).End(xlUp).row
            ReDim Opes(1 To Max)
            iCount = 1
            MsgBox "Begin"
            
            Do While iCount <= Max
                Opes(iCount) = Worksheets("Mode_Tracker_0001").Range(Column & iCount).Value
                Worksheets("Load").Visible = True
                MsgBox "UNBELIEVABLE"
                My_Sheet = Opes(iCount)
                Worksheets("My_Sheet").Visible = True
                'Worksheets("Mode_Tracker_0001").Range(Column & iCount).Visible = True
                iCount = iCount + 1
            Loop
            UserOption = GetOption(Opes, 1, "Pick a worksheet.")

Basically I create an array of strings and fill it with values on my worksheet "Mode_Tracker_0001". (Picked the name because it was unique.) Anyways this worksheet has values that represent actual other worksheets in the workbook.

I know the array excepts the values but when I attempt to make the sheets that have the names in the array Visible (They all start out xlSheetsVeryHidden.) the code will end without continuing at all.

What I am asking is what reasons could their be for this happening? I was unable to reproduce the error in another workbook so hopefully this will help you help me.

I appreciate any insight to this issue.

Current version I am using is Excel 2007 in a Windows 7 Environment.
I have already posted a similar thread at
http://www.excelforum.com/excel-pro...gets-hung-up-on-visible-line.html#post2536881

with no luck. Thank you in advance for any help.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,609
Messages
6,179,877
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top