![]() |
Pointing specific textbox
Hi,
Could someone tell how to initialize or place the cursor in a specific box on a userform, when I open the userform containing 4 text boxes. By default it goes in the first one. Thank's ahead. |
Pointing specific textbox
Just use the TextBox's SetFocus method. For example, if you wanted TextBox3
to have focus... Private Sub UserForm_Initialize() TextBox3.SetFocus End Sub -- Rick (MVP - Excel) "Bobby" wrote in message ... Hi, Could someone tell how to initialize or place the cursor in a specific box on a userform, when I open the userform containing 4 text boxes. By default it goes in the first one. Thank's ahead. |
Pointing specific textbox
On Apr 28, 3:00*pm, "Rick Rothstein"
wrote: Just use the TextBox's SetFocus method. For example, if you wanted TextBox3 to have focus... Private Sub UserForm_Initialize() * TextBox3.SetFocus End Sub -- Rick (MVP - Excel) "Bobby" wrote in message ... Hi, Could someone tell how to initialize or place the cursor in a specific box on a userform, when I open the userform containing 4 text boxes. By default it goes in the first one. Thank's ahead.- Hide quoted text - - Show quoted text - Great! Thank's How can I get the info selected after having the cursor in that specific box,so when I start typing the new number is written? Thank. |
Pointing specific textbox
Could someone tell how to initialize or place the cursor in a specific
box on a userform, when I open the userform containing 4 text boxes. By default it goes in the first one. Just use the TextBox's SetFocus method. For example, if you wanted TextBox3 to have focus... Private Sub UserForm_Initialize() TextBox3.SetFocus End Sub Great! Thank's First off, it is always a good idea to post in the same way as the person who responded to you (that is, keep posting all new responses to the top or bottom, but alternate between the top and the bottom as you did)... it keeps the flow of responses in an easy to follow order so people viewing the thread in the future can follow it more easily). I have repaired this message to bottom post to match your response, but in the future, it would be a better idea for you to adopt the method used by the person who responded to you.... How can I get the info selected after having the cursor in that specific box,so when I start typing the new number is written? So the new number is written **where**... to a Label on the UserForm, a cell in the worksheet, somewhere else? The code depends on how you want the user to interact with the UserForm. Are you just going to dump whatever the user types directly into wherever you want to display it at? Are you going to validate the entry first (if you are looking for a number and the user types "ABC", how are you going to handle that)? Are you going to use an OK button to signal that it is time to put the text wherever it will finally be placed... or will just the action of moving the focus to another control or closing the UserForm be the action that initiates the moving of the text to wherever it will finally be placed? When you work in the VB world, there is lots more to consider and control... you kind of have to have an overall idea what you want to do and how you want to do it or you will be tearing apart and rebuilding code all over the place. -- Rick (MVP - Excel) |
Pointing specific textbox
TRY THIS
Private Sub UserForm_Initialize() TextBox3.SetFocus End Sub "Bobby" wrote: Hi, Could someone tell how to initialize or place the cursor in a specific box on a userform, when I open the userform containing 4 text boxes. By default it goes in the first one. Thank's ahead. . |
Pointing specific textbox
On Apr 28, 3:39*pm, Mike wrote:
TRY THIS Private Sub UserForm_Initialize() TextBox3.SetFocus End Sub "Bobby" wrote: Hi, Could someone tell how to initialize or place the cursor in a specific box on a userform, when I open the userform containing 4 text boxes. By default it goes in the first one. Thank's ahead. .- Hide quoted text - - Show quoted text - Rick, to apply your recommandation regarding the usage of the group, there are 3 buttons: Reply Reply to author Forward Which one should I use? Regarding my last question, there no need for validation in this Userform. Just an assignment to specific cell. Thank's and regards. |
Pointing specific textbox
"Bobby" wrote in message
... On Apr 28, 3:39 pm, Mike wrote: TRY THIS Private Sub UserForm_Initialize() TextBox3.SetFocus End Sub "Bobby" wrote: Hi, Could someone tell how to initialize or place the cursor in a specific box on a userform, when I open the userform containing 4 text boxes. By default it goes in the first one. Thank's ahead. .- Hide quoted text - - Show quoted text - Rick, to apply your recommandation regarding the usage of the group, there are 3 buttons: Reply Reply to author Forward Which one should I use? Regarding my last question, there no need for validation in this Userform. Just an assignment to specific cell. Thank's and regards. In that case, I would just assign the TextBox's ControlSource property to the cell you want to display the text in. You will find the ControlSource property in the Project Properties window... just select the TextBox first, then type in the address (along with its worksheet) in the space to the right of the ControlSource property; for example, Sheet3!H7. You can do that for each TextBox (using a different cell address, of course)... then, when the user hits the Enter key or moves the focus to another control, the text in the TextBox will be entered into the specified cell. -- Rick (MVP - Excel) |
All times are GMT +1. The time now is 10:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com