0

I am curious how to make the value of a text box dynamically change when you select a different option button or toggle with a spin button. What I have tried so far is Userform1.textbox1.value = spinbutton1

Is there a better way to do this??

Thanks.

Community
  • 1
  • 1
Zack Withrow
  • 125
  • 1
  • 2
  • 11

1 Answers1

2

Well, you are on the right track, but it would be:

 Userform1.textbox1.value = spinbutton1.value

And, you'd want to have that code inside of the spinbutton1's change event handler.

Scott Marcus
  • 64,069
  • 6
  • 49
  • 71
  • Beautiful! thank you. If I may ask a follow up question, Where would you place the code if you wanted a label's text to dynamically change? – Zack Withrow Mar 16 '16 at 15:58
  • 1
    When you want code to run, the first thing to do is ask yourself "When do I want this code to run?" The answer to that question will tell you where the code goes. If the label needs it's text to change dynamically, you need to know when that change has to happen. if, for example, it needs to happen when you click a button, then you need to create a click event handler for that button and put the code in there. Also, don't forget to mark this as the answer. Thanks! – Scott Marcus Mar 16 '16 at 19:10