Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to paste range to new worksheet loses formats

Status
Not open for further replies.

kajaeger

Programmer
Oct 5, 2001
17
0
0
US
I am writing a macro that copies certain ranges into a CSV file to load data into Oracle. But, when I try to copy my range, sometimes the values are getting messed up. How can I maintain the formatting of my pasted range when pasting into a CSV file? I keep losing my formats. For example I try to paste values like
00000437
00000427
-E1j3j35
67482822

but when it saves into the CSV, I lose my cell formatting.

it looks like
437
427
#NAME
67482822

Any ideas?
 
A CSV file? Where is the CSV file? In Excel? If so, it's not REALLY a CSV file until you save it as one. You may be better off using Word tables for a real CSV file so everything is seen as text. I did a couple of tests, tho, and found when I:

Format the column as text, save as CSV, open in Word, leading zeroes appear.

Put an apostrophe in front of the zip, i.e., '08940, save as CSV, open in Word, leading zeroes appear. dreamboat@nni.com
Brainbench MVP for Microsoft Word
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top