Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text box in form


Hi guys

I have a text box in a user form that take is linked to sheet1! G3

But G3 had the formula that works out the prices from different sheets
and show the answer. I can only seem to use the text box once it shows
the number but Deletes the formula and just leaves the figure in the
cell G3 I just need the text box as a display box?

Also i can not seem to get the text box to display £ and the 0 on the
end of pence e.g. 123.1 and it should be £123.10

Thanks for your help


--
raw
------------------------------------------------------------------------
raw's Profile: http://www.excelforum.com/member.php...o&userid=28312
View this thread: http://www.excelforum.com/showthread...hreadid=479531

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text box in form


Good evening raw

We can solve both of these with one line of code:

TextBox1.Text = Format(Range("Sheet1!G3").Value, "£#,###.00")

However, this is probably a bit of a diversion to the way you've
probably done it, especially if you've linked the textbox to the value
property, but this is the better way to go.

If you struggle to implement this post back and we'll take it from
there.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=479531

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text box in form


Hi Thanks for the code

This maybe a stupied question but where do you put this code?

Thanks


--
raw
------------------------------------------------------------------------
raw's Profile: http://www.excelforum.com/member.php...o&userid=28312
View this thread: http://www.excelforum.com/showthread...hreadid=479531

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text box in form


Hi raw

Well, it really depends on how your spreadsheet is set up.

Say, you're using UserForm1 and your textbox is called TextBox1 and you
have a macro calling Userform1:

Sub Test()
UserForm1.Show
End Sub

From the VBE double click on the UserForm you've designed and copy this
code into the pane that opens:

Private Sub UserForm_Initialize()
TextBox1.Text = Format(Range("Sheet1!G3").Value, "£#,###.00")
End Sub

Now, when you run the macro "Test", UserForm1 should open and TextBox1
will contain the value of G3 formatted in £ and pence.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=479531

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text box in form


Hi Thanks for that

Worked

Thank you


--
raw
------------------------------------------------------------------------
raw's Profile: http://www.excelforum.com/member.php...o&userid=28312
View this thread: http://www.excelforum.com/showthread...hreadid=479531



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text box in form


Hi raw

You're welcome. Thanks for the feedback.

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=479531

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
2 criteria lookup of text. Return text form column 3. SUMPRODUCT t zzxxcc Excel Worksheet Functions 2 August 26th 08 11:04 PM
DATE IN TEXT FORM - NEED TO CHANGE IT DATE FORM SSJ New Users to Excel 3 October 27th 06 08:34 PM
Formatting text in a user form text box DB Excel Programming 0 July 23rd 05 08:09 PM
VBA - Form Text box value Linda Excel Programming 1 December 4th 03 06:56 PM
text box on a form Eric W. Excel Programming 2 July 20th 03 01:10 AM


All times are GMT +1. The time now is 03:58 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"