+ Reply to Thread
Results 1 to 2 of 2

UserForm

  1. #1
    Steve
    Guest

    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.


  2. #2
    Dave Peterson
    Guest

    Re: 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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1