#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Activating userform and filling it with data form row where userform is activate Marthijn Beusekom via OfficeKB.com[_2_] Excel Programming 3 May 6th 05 05:44 PM
Access from add_in userform to main template userform.... Ajit Excel Programming 1 November 18th 04 05:15 PM
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM
Userform inside another userform Ryan Excel Programming 0 April 23rd 04 08:01 PM
userform Tom Ogilvy Excel Programming 1 September 2nd 03 10:12 PM


All times are GMT +1. The time now is 06:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"