![]() |
UserForm
I have a UserForm that has a drop box with all of the worksheet names in the
drop box. When the user clicks the worksheet name, that worksheet becomes the active sheet on the screen. However, the cursor focus stays in the drop box and I want the focus and the cursor to go the the worksheet. The UserForm should lose the focus and Excel and the worksheet should get the focus. NO LUCK! Please help. |
UserForm
I created a small userform with a combobox and a commandbutton (to cancel) on
them. This code showed the form: Option Explicit Sub testme() UserForm1.Show vbModeless End Sub This code was behind the userform: Option Explicit Private Sub ComboBox1_Change() On Error Resume Next Sheets(Me.ComboBox1.Value).Select If Err.Number < 0 Then MsgBox "Error Selecting sheet: " & Me.ComboBox1.Value Err.Clear End If On Error GoTo 0 AppActivate Application.Caption End Sub Private Sub CommandButton1_Click() Unload Me End Sub Private Sub UserForm_Initialize() Dim wks As Object For Each wks In ActiveWorkbook.Sheets Me.ComboBox1.AddItem wks.Name Next wks End Sub ======== Another idea would be to use a floating toolbar. If you want to look into that, here's a link to an old post. http://groups.google.com/groups?thre...1C74%40msn.com Steve wrote: I have a UserForm that has a drop box with all of the worksheet names in the drop box. When the user clicks the worksheet name, that worksheet becomes the active sheet on the screen. However, the cursor focus stays in the drop box and I want the focus and the cursor to go the the worksheet. The UserForm should lose the focus and Excel and the worksheet should get the focus. NO LUCK! Please help. -- Dave Peterson |
All times are GMT +1. The time now is 09:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com