Thanks! I seem however to have two problems. I thought I knew how to count
the textboxes in a frame but I have a problem with my code:
numberOfTextBoxes = StartPriceFrame.TextBoxes.Count
It simple does not work. Do you perhaps know how to write the code for this?
The second problem is that I need to use the value for the number of
textboxes in another sub in the userform (e.g. there are five textboxes i.e.
the number 5). But the varibale numberOfTextBoxes dies after the initialize
sub. Can you send this variable along or should I declare it is a modular
variable? I would be very thankful if you could help me with this!
"NickHK" skrev:
Nick,
Yes, you would need code like:
Private sub UserForm_Initialize()
'Code Here e.g.
TextBox1.SetFocus
End sub
The _Initialize event is fired when the Userform is first shown and the
_Activate event fires whenever the form receives focus.
Check out the Help for (in English) "Understanding Objects, Properties,
Methods, and Events"
NickHK
"Nick London" wrote in message
...
Thank you. I am however not very accostomed to VB. How do you the
UserForm_Activate() and UserForm_Initialize() ? Do you write:
Private sub UserForm_Activate()
.....count checkboxes
End sub
or how do you use it? Would be very much appreciated with help since I
dont
really know my way around these blocks....
"NickHK" skrev:
The Userform has various events that you can respond to. I would
UserForm_Activate() and UserForm_Initialize() are the ones you are
looking
for.
NickHK
"Nick London" wrote in message
...
I have I user form that is shown when the user presses a button on a
spreadsheet.
The code in the spreasheet is:
Public Sub startKnapp_Click()
userForm1.Show
End Sub
Then the userform is shown. I want to do certain things when the
userform
is
opened etc. count number of textboxes. How do you write code so that
the
program does certain things directly when the userform is opened i.e.
the
user shall not be forced to press a button or move the cursor over
certain
areas etc.? Please help me if you know how! Thanks!