Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
I need to add spaces to the beginning of my texts which are numbers
example I have various account numbers as texts from 4 to 7 digits. I
need to make all account numbers 10 digits long with spaces at the beginning. Another example.... _ _ _ 1234567. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
I need to add spaces to the beginning of my texts which are numbers
Sub fill_spaces_left()
Dim s As String Dim cell As Range For Each cell In Selection With cell .NumberFormat = "@" .HorizontalAlignment = xlRight s = .Value If Len(s) < 10 Then .Value = Space$(10 - Len(s)) & s End If End With Next End Sub Gord On Tue, 24 Apr 2012 10:46:10 -0700 (PDT), Demetria Jones wrote: example I have various account numbers as texts from 4 to 7 digits. I need to make all account numbers 10 digits long with spaces at the beginning. Another example.... _ _ _ 1234567. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I remove spaces at the beginning of cells? | Excel Discussion (Misc queries) | |||
Delete Variable spaces at beginning of a range | Excel Programming | |||
How can I insert 2 spaces at the beginning of each of 1300 cells? | Excel Discussion (Misc queries) | |||
How do I eliminate spaces/characters from the beginning of a cell | Excel Worksheet Functions | |||
Remove Spaces beginning Time entry | Excel Discussion (Misc queries) |