Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Keeping 0 at beginning
I have a amcro that splits up the info in a cell by using text to columns.
This works fine and everything comes out right execpt for one of the data sets has a leading 0 that disappers when in the split up form. Let me give you an exaple. I have a cell with the follwoing string: "ACGB 4.75 0311". This is then split up so that it in 3 different cells shows: "ACGB" (e.g. in cell b1) and "4.75" (e.g. in cell b2 and "311" (in e.g. cell b3). Notice how the leadÃ*ng 0 is gone. In my code I set the format of the cells to text but it does not work. Con you please help me fix this problem? I know it does not sound very important but it makes my program not very useful. My code is: Do Until IsEmpty(rngSecID.Offset(r, lngTypeColumn)) r = r + 1 If rngSecID.Offset(r, lngTypeColumn).Text = strGovBond Then rngSecID.Offset(r, lngColumnRight).Select Selection.NumberFormat = "@" rngSecID.Offset(r, 0).Select Selection.TextToColumns Destination:=rngSecID.Offset(r, lngColumnRight), DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), TrailingMinusNumbers:=True End If Loop Please any help appreciated! Thanks alot! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Beginning of Year | Excel Worksheet Functions | |||
Add Beginning Text | Excel Discussion (Misc queries) | |||
How do i add " to the beginning of all cells | Excel Discussion (Misc queries) | |||
add "0" to the beginning of each value | Excel Worksheet Functions | |||
Beginning forms | Excel Programming |