PC Review


Reply
Thread Tools Rate Thread

Converting a file to text

 
 
jhong
Guest
Posts: n/a
 
      21st Feb 2008
Hi Everyone,


I've got this very useful code from this forum, im running this code
to my excel file that has plenty of sheets with cost centers as sheet
names. My problem is each cost center starts with zero like 011888
when i run this code the macro will only get 11888 without the zero,
can you help me edit this code so it an get all the code as it is.
Thanks in advance!!

Dim NewSheet As Variant

Dim i As Integer


Set NewSheet = Sheets.Add(Type:=xlWorksheet)
For i = 1 To Sheets.Count
NewSheet.Cells(i, 1).Value = Sheets(i).Name
Next i
 
Reply With Quote
 
 
 
 
johnmanivong@earthlink.net
Guest
Posts: n/a
 
      21st Feb 2008
On Feb 20, 9:36*pm, jhong <jerome.tam...@gmail.com> wrote:
> Hi Everyone,
>
> I've got this very useful code from this forum, im running this code
> to my excel file that has plenty of sheets with cost centers as sheet
> names. My problem is each cost center starts with zero like 011888
> when i run this code the macro will only get 11888 without the zero,
> can you help me edit this code so it an get all the code as it is.
> Thanks in advance!!
>
> Dim NewSheet As Variant
>
> Dim i As Integer
>
> Set NewSheet = Sheets.Add(Type:=xlWorksheet)
> For i = 1 To Sheets.Count
> * * NewSheet.Cells(i, 1).Value = Sheets(i).Name
> Next i


Try this
Dim NewSheet As Variant
Dim i As Integer
Set NewSheet = Sheets.Add(Type:=xlWorksheet)
For i = 1 To Sheets.Count
NewSheet.Cells(i, 1).NumberFormat = "@"
NewSheet.Cells(i, 1).Value = Sheets(i).Name
Next i

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting Excel file to text delimited file =?Utf-8?B?S2lyYW4gVmVlcmFtYWxsdQ==?= Microsoft Excel Misc 3 1st May 2007 07:04 PM
Converting an Excel file to fixed length ASCII (text) file =?Utf-8?B?WUkgTWFu?= Microsoft Excel Misc 2 5th Oct 2004 12:00 AM
Converting excel to text file - Issue with wrapping text giridar Microsoft Excel Misc 7 27th Aug 2004 06:34 PM
Converting text file in to excel file =?Utf-8?B?QXNob2s=?= Microsoft Excel Misc 1 30th Mar 2004 01:03 AM
Converting to text file khan Microsoft Excel Misc 0 15th Jan 2004 05:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:47 AM.