hi folks
I have the following code and [v]*[/v] in ThisWorkbook:
Code
Public sLast as Object
Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.CodeName <> "Sheet8" Then
Set sLast = Sh
End If
End Sub
Display More
and my form has the following code:
Code
Private Sub ComboBox1_Click()
Sheet8.Activate
Sheet8.Range("IV1").Value = "Problem" & ComboBox1.ListIndex + 1
Me.Controls("ListBox1").RowSource = "try"
Me.TextBox1.Value = ""
End Sub
Private Sub ListBox1_Click()
Me.TextBox1.Value = Cells(Me.ListBox1.ListIndex + 2, Me.ComboBox1.ListIndex + 16).Value
End Sub
Private Sub Exitbutton()
Unload Me
End Sub
Private Sub UserForm_Terminate()
sLast.Select
End Sub
Display More
what i was hoping would happen, is when the user exits the Form they are directed back to the previous sheet they were on. I get a runtime error. Can anyone point me out where im going wrong, or better still, advise how I can run my form without actually selecting the sheet (sheet8) where the data for the dropdown box etc resides?
p.s "try" is a [nr]*[/nr]
Many Thanks
Jamie