Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Unable to format a control in a Userform

I have a Userform which has the .controlsources set to named ranges in one
of the sheets. There are 3 ranges on the sheet that are Custom formatted
with leading zeros such as "000". If a 1 is entered it is displayed on the
sheet as 001.

However, in the form the number shows as 1. I have tried Text(<name, "000")
but that doesn't take.

How do I display the numbers with a custom format?

Thanks.

Rick

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,276
Default Unable to format a control in a Userform

Hi,
try

Private Sub TxtApril_Change()
Me.TxtApril.Value = Format(Me.TxtApril.Value, "000")
End Sub

Change TxtApril to your box name

"rick" wrote:

I have a Userform which has the .controlsources set to named ranges in one
of the sheets. There are 3 ranges on the sheet that are Custom formatted
with leading zeros such as "000". If a 1 is entered it is displayed on the
sheet as 001.

However, in the form the number shows as 1. I have tried Text(<name, "000")
but that doesn't take.

How do I display the numbers with a custom format?

Thanks.

Rick


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Unable to format a control in a Userform

formatting doesn't affect the cell content, just how it appears. So when this
is dropped into say a listbox, its the cell content thats loaded.
You'll need to either (1) load from another range where the TEXT of the cell
matches the format or (2) load when the form initilaises using a for/next
noop and this type of adjustment:
ListBox1.AddItem Format$(Cells(index, 3), "0000")


I'd go for (1) since all you need to do is enter =TEXT(A1,"0000") into an
adjoining column


"rick" wrote:

I have a Userform which has the .controlsources set to named ranges in one
of the sheets. There are 3 ranges on the sheet that are Custom formatted
with leading zeros such as "000". If a 1 is entered it is displayed on the
sheet as 001.

However, in the form the number shows as 1. I have tried Text(<name, "000")
but that doesn't take.

How do I display the numbers with a custom format?

Thanks.

Rick


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
Unable to pass a control to a sub Paolo Sardi Excel Programming 1 February 2nd 09 05:37 PM
Selecting control on userform with part of control name (set question) Keith Excel Programming 4 January 10th 07 02:24 PM
Unable to add references to Calendar control and outlook object utham raj via OfficeKB.com Setting up and Configuration of Excel 0 February 3rd 05 09:48 AM
Control Sequence from Userform Control Nigel Excel Programming 3 December 29th 04 01:25 PM
unable to control screenupdating Susan Lammi Excel Programming 3 September 26th 03 05:04 AM


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