changing value on a userform

C

Charlie

I have a cell (B1) that is this:
=IF(A1=1,"You may continue:"," ")
I have a textbox on a userform with the control source to this cell B1, when
I open the form, it shows "You may continue" in the text box, but when the
cell A1 is changed by a listbox on the same form to a number higher than 1,
now this text box becomes blank, which is what I expected. But when the form
is closed, now the formula in B1 is gone, B1 is blank. ...I just simply want
to display the value given by the formula in B1 on my form, but this value
can be changed with other controls on the form... Can this be done?
 
C

carlo

Take the control source away, because that overwrites the formula in
B1
Instead do following:
When you open the form and when after updating the listbox, assign the
value of b1 to the textbox.

hope you know what i mean.

Carlo
 
C

Charlie

I put code in the initialize() sub of the form, but I can't figure out the
syntax. ...this must be close?
Private Sub UserForm_Initialize()
TextBoxtest = Sheet1!B23
End Sub
....then I'd put the same code in the combobox change() that affects
textboxtest? It's a combobox, not a listbox that I have that has an affect
 
C

carlo

Hey Charlie

you're close, but you have to use VBA syntax to get the value of the
cell:

Private Sub UserForm_Initialize()
TextBoxtest = worksheets("Sheet1").range("B23").value
End Sub

try this and give me feedback.

Carlo
 

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

Top