Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform problem, bordercolor not changing around images spyd3r Excel Programming 0 January 5th 06 01:19 AM
Programatically changing picture in UserForm - VBA - Mac OSX dirk Excel Programming 2 May 14th 04 12:40 PM
changing selected label on userform w/ a variable mike k Excel Programming 1 February 19th 04 01:48 AM
Changing Thumbnail Pictures in a UserForm pcsis Excel Programming 1 January 3rd 04 11:09 PM
Assigning the name of a userform/control to a changing string Brad Patterson Excel Programming 2 July 16th 03 11:00 PM


All times are GMT +1. The time now is 09:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"