Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
changing value on a userform
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
changing value on a userform
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 On Dec 21, 2:24*pm, Charlie wrote: 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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
changing value on a userform
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 on this 2nd textbox. "carlo" wrote: 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 On Dec 21, 2:24 pm, Charlie wrote: 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? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
changing value on a userform
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 On Dec 21, 10:47*pm, Charlie wrote: 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 on this 2nd textbox. "carlo" wrote: 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 On Dec 21, 2:24 pm, Charlie wrote: 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?- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform problem, bordercolor not changing around images | Excel Programming | |||
Programatically changing picture in UserForm - VBA - Mac OSX | Excel Programming | |||
changing selected label on userform w/ a variable | Excel Programming | |||
Changing Thumbnail Pictures in a UserForm | Excel Programming | |||
Assigning the name of a userform/control to a changing string | Excel Programming |