Change UserForm ControlSource with VBA

  • Thread starter Thread starter jim.excel
  • Start date Start date
J

jim.excel

Hi,

My desired scenario...

Private Sub Sale_Notes_OptionButton_Click()
Change Value of Notes_TextBox CONTROLSOURCE Value here...
End Sub


Private Sub Delivery_Notes_OptionButton_Click()
Change Value of Notes_TextBox CONTROLSOURCE Value to Something Else
here...
End Sub


The OptionButtons and Notes_TextBox are on a UserForm.

I want to be able to change what text is displayed in Notes_TextBox
(from named cells on various worksheets) by clicking on appropriate
Option Buttons on the UserForm.

Can I do this?

Thanks,
Jim
 
Hello Jim
Very easily done if you use named ranges:
Private Sub Delivery_Notes_OptionButton_Click()
Me.Notes_TextBox.value = Range("Sale").Value
End Sub
Private Sub Delivery_Notes_OptionButton_Click()
Me.Notes_TextBox.Value = Range("Delivery").Value
End Sub

HTH
Cordially
 
Sorry juste realised I didn't read through all of your post
If these are option buttons then you may use something like:
Private Sub Delivery_Notes_OptionButton_Click()
If Delivery_Notes_optionButton Then
Me.Notes_TextBox.value = Range("Sale").Value
End If
End Sub
Private Sub Delivery_Notes_OptionButton_Click()
If Delivery_Notes_OptionButton Then
Me.Notes_TextBox.Value = Range("Delivery").Value
End If
End Sub

HTH
Cordially
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top