Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Textbox format

Hi

I have the following code to pick up infomation from the spreadsheet
and show it in my userform.


Dim text1 As Long

text1 = UserForm6.TextBox1.Value

Range("A4").Select
Set material1 = Selection

material1.Value = text1

If the number on the spreadsheet is to 2 decimal places the result is
rounded, ie 2.72 is shown as 3.

Any suggestions to resolve the problem will be gratfully recieved.

Regards

Oggy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Textbox format

Oggy,
Change the data type of text1 from Long to Double.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Oggy"
wrote in message
Hi
I have the following code to pick up infomation from the spreadsheet
and show it in my userform.

Dim text1 As Long

text1 = UserForm6.TextBox1.Value

Range("A4").Select
Set material1 = Selection

material1.Value = text1

If the number on the spreadsheet is to 2 decimal places the result is
rounded, ie 2.72 is shown as 3.
Any suggestions to resolve the problem will be gratfully recieved.
Regards
Oggy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Textbox format

you have declared text 1 as long (Long Integer) which will force an implicit
conversion of your decimal to an integer. Change the declaration to double

Dim text1 as double
--
HTH...

Jim Thomlinson


"Oggy" wrote:

Hi

I have the following code to pick up infomation from the spreadsheet
and show it in my userform.


Dim text1 As Long

text1 = UserForm6.TextBox1.Value

Range("A4").Select
Set material1 = Selection

material1.Value = text1

If the number on the spreadsheet is to 2 decimal places the result is
rounded, ie 2.72 is shown as 3.

Any suggestions to resolve the problem will be gratfully recieved.

Regards

Oggy


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
TextBox format? Pas Excel Discussion (Misc queries) 5 April 25th 10 11:13 PM
TextBox format? AOU Excel Discussion (Misc queries) 4 June 12th 07 11:24 PM
textbox format [email protected] Excel Programming 2 May 18th 06 02:10 AM
TextBox Format grahammal Excel Discussion (Misc queries) 3 March 29th 06 01:35 PM
Format Textbox as % Todd Huttenstine[_2_] Excel Programming 2 December 15th 03 12:07 AM


All times are GMT +1. The time now is 08:49 AM.

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"