|
-
Mar 20th, 2006, 05:29 AM
#1
Thread Starter
Addicted Member
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
Last edited by bolcskei; Mar 20th, 2006 at 06:32 AM.
Reason: [RESOLVED]
-
Mar 20th, 2006, 05:31 AM
#2
Re: change spinbutton value after textbox event
Which Office app are you using? Which version?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 20th, 2006, 05:39 AM
#3
Thread Starter
Addicted Member
Re: change spinbutton value after textbox event
 Originally Posted by RobDog888
Which Office app are you using? Which version?
I am sorry. It is in Excel and I have VBA.
-
Mar 20th, 2006, 05:43 AM
#4
Re: change spinbutton value after textbox event
Open Excel, Help, About MSExcel, which version
-
Mar 20th, 2006, 05:46 AM
#5
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
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Mar 20th, 2006, 06:17 AM
#6
Thread Starter
Addicted Member
Re: change spinbutton value after textbox event
 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.
-
Mar 20th, 2006, 06:28 AM
#7
Thread Starter
Addicted Member
Re: change spinbutton value after textbox event
 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.
-
Mar 20th, 2006, 02:51 PM
#8
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
-
Mar 21st, 2006, 01:07 AM
#9
Thread Starter
Addicted Member
Re: change spinbutton value after textbox event [RESOLVED]
 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.
Boris
the mistake must be between the keyboard and the chair!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|