Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Format from Row Source

Hi All

We use a fair few numbers with a leading zero - enters OK in a UserForm
textbox Tb1, however it always drops it on entering the cell on the sheet. Is
there anyway to retain the format of a leading zero. The code for the row
source is below.

Range(Me.Lb1.RowSource).Resize(1, 1).Offset(Me.Lb1.ListIndex, 3) =
Me.Tb1.Value
--
Many thanks

hazel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Format from Row Source

You could format that cell as text, then plop the value into it:

with Range(Me.Lb1.RowSource).Resize(1, 1).Offset(Me.Lb1.ListIndex, 3)
.numberformat = "@"
.value = Me.Tb1.Value
end with

Or you could prefix the value with an apostrophe:

Range(Me.Lb1.RowSource).Resize(1, 1).Offset(Me.Lb1.ListIndex, 3).value _
= "'" & me.Tb1.Value



Hazel wrote:

Hi All

We use a fair few numbers with a leading zero - enters OK in a UserForm
textbox Tb1, however it always drops it on entering the cell on the sheet. Is
there anyway to retain the format of a leading zero. The code for the row
source is below.

Range(Me.Lb1.RowSource).Resize(1, 1).Offset(Me.Lb1.ListIndex, 3) =
Me.Tb1.Value
--
Many thanks

hazel


--

Dave Peterson
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
Can Not get cell to accept any format change! Source from html Quentin Excel Worksheet Functions 1 April 4th 09 12:08 AM
Pivot Table Format from Source Data tommcbrny Excel Discussion (Misc queries) 0 February 6th 09 08:12 PM
How to retain format for linked data source Metcare Charts and Charting in Excel 0 August 10th 08 02:46 PM
Pivot Table Row Field Format (OLAP Source) Adrian Morris Excel Discussion (Misc queries) 2 December 16th 05 10:37 AM
how do I format a cell reference to move as source changes KGray Excel Worksheet Functions 1 August 13th 05 12:41 AM


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