CaptRon
01-04-2008, 01:32 PM
This code is associated with a userform (FrmOAINav) and runs fine on my PC but on 2 other office machines it locks up Excel. Opening VBE then executing the code indicates that it is simply running.........and running......and running.....
Would someone please take a look at this code to see what I may have done wrong that would cause this?
Thanks, Ron
Private Sub ListBox1_Click()
On Error GoTo ErrorHandler
Dim i As Integer, sht As String
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
sht = ListBox1.List(i)
End If
Next i
Sheets(sht).Activate
ErrorHandler:
End Sub
Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Outcome" And ws.Name <> "Efficiency" And ws.Name <> "Explanatory" And ws.Name <> "Output" Then
ListBox1.AddItem (ws.Name)
End If
Next ws
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Would someone please take a look at this code to see what I may have done wrong that would cause this?
Thanks, Ron
Private Sub ListBox1_Click()
On Error GoTo ErrorHandler
Dim i As Integer, sht As String
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
sht = ListBox1.List(i)
End If
Next i
Sheets(sht).Activate
ErrorHandler:
End Sub
Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Outcome" And ws.Name <> "Efficiency" And ws.Name <> "Explanatory" And ws.Name <> "Output" Then
ListBox1.AddItem (ws.Name)
End If
Next ws
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub