![]() |
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 |
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 |
All times are GMT +1. The time now is 07:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com