PC Review


Reply
Thread Tools Rate Thread

changing value on a userform

 
 
Charlie
Guest
Posts: n/a
 
      21st Dec 2007
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?

 
Reply With Quote
 
 
 
 
carlo
Guest
Posts: n/a
 
      21st Dec 2007
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 <Char...@discussions.microsoft.com> 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 theform
> is closed, now the formula in B1 is gone, B1 is blank. *...I just simplywant
> 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?


 
Reply With Quote
 
Charlie
Guest
Posts: n/a
 
      21st Dec 2007
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 <Char...@discussions.microsoft.com> 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?

>
>

 
Reply With Quote
 
carlo
Guest
Posts: n/a
 
      25th Dec 2007
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 <Char...@discussions.microsoft.com>
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 <Char...@discussions.microsoft.com> 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 whenthe
> > > 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 whenthe 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing the controls for a userform baha17@gmail.com Microsoft Excel Programming 4 24th Dec 2010 06:26 AM
Changing the text of a label on a Userform Robert Crandal Microsoft Excel Programming 1 7th Dec 2009 08:39 AM
Problem changing font on Userform John Crawford Microsoft Powerpoint 0 23rd Dec 2007 01:41 PM
Programatically changing picture in UserForm - VBA - Mac OSX dirk Microsoft Excel Programming 2 14th May 2004 12:40 PM
Changing Thumbnail Pictures in a UserForm pcsis Microsoft Excel Programming 1 3rd Jan 2004 11:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:54 AM.