change spinbutton value after textbox event [RESOLVED]
Hi guys,
I have probably very simple problem. I would like to set spinbutton value equal to textbox. I am using the following code:
VB Code:
Private Sub TextBox3_Click()
UserForm1.SpinButton2.Value = UserForm1.TextBox3.Value
End Sub
Can anybody help me, what I did wrong?
Thanks.
Boris
Re: change spinbutton value after textbox event
Which Office app are you using? Which version?
Re: change spinbutton value after textbox event
Quote:
Originally Posted by RobDog888
Which Office app are you using? Which version?
I am sorry. It is in Excel and I have VBA.
Re: change spinbutton value after textbox event
Open Excel, Help, About MSExcel, which version
Re: change spinbutton value after textbox event
You have it backwards. You are trying to get the spinbutton to increment or decrement the value in the textbox?
VB Code:
Private Sub SpinButton1_Change()
UserForm1.TextBox1.Value = UserForm1.SpinButton1.Value
End Sub
Moved
Re: change spinbutton value after textbox event
Quote:
Originally Posted by RobDog888
You have it backwards. You are trying to get the spinbutton to increment or decrement the value in the textbox?
VB Code:
Private Sub SpinButton1_Change()
UserForm1.TextBox1.Value = UserForm1.SpinButton1.Value
End Sub
Moved
I have MS Office XP.
"Showing" spinbutton value in textbox I have done. It works fine. But I would like to do a opposite procedure. To set the value of spinbutton based on the value of textbox. Now I did an idea, maybe I have to convert textbox value to number.
Re: change spinbutton value after textbox event
Quote:
Originally Posted by RobDog888
You have it backwards. You are trying to get the spinbutton to increment or decrement the value in the textbox?
VB Code:
Private Sub SpinButton1_Change()
UserForm1.TextBox1.Value = UserForm1.SpinButton1.Value
End Sub
Moved
I did a mistake. Textbox do not have click event.
Re: change spinbutton value after textbox event [RESOLVED]
Incidentally, did you know that you can use the LinkedCell property of the spin button to link it to the value of a cell.
If you didn't want to use a textbox, that is. I hardly ever use textboxes in Excel, because using a cell is so much more flexible.
zaza
Re: change spinbutton value after textbox event [RESOLVED]
Quote:
Originally Posted by zaza
Incidentally, did you know that you can use the LinkedCell property of the spin button to link it to the value of a cell.
If you didn't want to use a textbox, that is. I hardly ever use textboxes in Excel, because using a cell is so much more flexible.
zaza
I did not know that. I do not like to use linked cell, because I like to prepare macros independent to opened file. Of course the linked cell I use with controls in Excel.
But, thanks for an idea.