Anthony's VBA Forum Index Anthony's VBA Forum
Where the knowledge is shared
Menu
 Anthony's VBA Forum IndexHome Page
 Anthony's VBA Forum IndexForum Index
FAQFAQ
MemberlistMemberlist
UsergroupsUsergroups
RegisterRegister
ProfileProfile
Log in to check your private messagesMessages
Log inLogin/Out

Quick Search

Advanced Search

Links
Consulting
Products

Who's Online
[ Administrator ]
[ Moderator ]


Userforms Help-Please

 
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA
View previous topic :: View next topic  
Author Message
blaq78



Joined: 31 Oct 2008
Posts: 2
Location: Canada

PostPosted: Mon Dec 29, 2008 5:42 pm    Post subject: Userforms Help-Please Reply with quote

I have two questions. First, how do i get the userform to stay active when a user clicks the enter key and is there a way to write a code for the enter key to act as tab?
Secondly, i need to put Back buttons on my userforms and to be able to go back and edit a previous form if need be, how can this be done?

Thanks for your help.

blaq
Back to top
View user's profile Send private message
Kenneth Hobson
Gold Member
Gold Member


Joined: 25 Mar 2007
Posts: 21
Location: Tecumseh, OK

PostPosted: Wed Mar 04, 2009 10:54 pm    Post subject: Reply with quote

The Enter key issue depends on what controls you want to use for that behavior. For Textbox controls, set the EnterKeyBehavior=True. Be sure to set the TagIndex values. For CommandButton controls, you will need to use its KeyDown event to check like this:

[code]Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then TextBox1.SetFocus
End Sub[/code]

For question 2, you could use a Multipage control. Or something like:

[code]Private Sub CommandButton1_Click()
UserForm1.Show
Unload Me
End Sub[quote][/quote][/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Anthony's VBA Forum Index -> General Excel VBA All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group