Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default visible zeros

you should be able to force at import time, but if you can't -- perhaps
something like this?

(assumes all the numbers should be the same number of characters)

reads incorrectly formatted row
creates a mirror range using REPT and LEN to add the correct number of 0s
copy pastespecial values to original range
clear mirror range

cheers - voodooJoe

Sub AddLeading000s_EDITtoSUIT()
Dim BananaPatch As Range, MustangSally As Range

Set BananaPatch = Sheet1.Range("D3:D7")
With BananaPatch
Set MustangSally = Sheet1.Range("F3").Resize(rowsize:=.Rows.Count,
columnsize:=.Columns.Count)
End With
With MustangSally
.FormulaArray = "=REPT(""0"",5-LEN(" & rngSource.Address & "))" & "
& " & rngSource.Address
.Copy
BananaPatch.PasteSpecial xlPasteValues
.Clear
End With

End Sub

"Ella" wrote in message
ups.com...
Joe,

thanks for helping, unfortunately i did that before i got online and
that doesn't work. Any other advice i can try?
thanks
ella


voodooJoe wrote:
ella -

you need to do this when you import the data.

if you import the value '0012345' as a 'number' or "General" format, XL
reads it as a number and drops the leading 0s. If you import as text, XL
will read it as a string. You can set this at import time - try walking
through it manually and importing a small comma deliminated text file to
see.

cheers - voodooJoe

"Ella" wrote in message
oups.com...
yes it is a number with a leading 0. Format as text does display the
zero only if i go back into the column and type in the zero itself. Not
effecient because there are thousands of records. Any other
advise...pleassseee.




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
when i megre cells that begin with zeros , I lose the zeros RDC Excel Discussion (Misc queries) 1 November 16th 07 03:31 PM
Essbase: Text zeros to number zeros santhu Excel Discussion (Misc queries) 1 March 23rd 07 01:01 PM
Worksheet has to set to visible as it is not visible after saving and closing Excel by VB. Oscar Excel Programming 6 June 21st 05 10:39 PM
save text field w/ leading zeros in .csv format & not lose zeros? Ques Excel Discussion (Misc queries) 1 May 4th 05 06:21 PM
Autoshapes not visible on spreadsheet but visible in print preview John Excel Discussion (Misc queries) 3 February 11th 05 10:23 PM


All times are GMT +1. The time now is 07:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"