Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default format cells as "Text"


Hi,

I'm copying a some numerical -codes into a range (say "A:B"), some of
the codes starts with a zero so, after copy Excel converts them numbers
and removes the leading zero.
This is creating a slight problem in my program.

If anybody knows a way to format the range as Text or String, using VBA
in a macro, please let me know.

I cannot do the excel formatting and save the sheet coz' the sheet is
created based on certain user-input.

Thanks in Advance,
Maneesh Hari

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default format cells as "Text"

Range("A:B").NumberFormat= "@"

HTH

Die_Another_Day

Phaedrus wrote:
Hi,

I'm copying a some numerical -codes into a range (say "A:B"), some of
the codes starts with a zero so, after copy Excel converts them numbers
and removes the leading zero.
This is creating a slight problem in my program.

If anybody knows a way to format the range as Text or String, using VBA
in a macro, please let me know.

I cannot do the excel formatting and save the sheet coz' the sheet is
created based on certain user-input.

Thanks in Advance,
Maneesh Hari


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default format cells as "Text"


DAD :),

this option works perfect. (I was trying with = "Text" and it was
giving me garbage data)

thanks for your help. Really appreciate it.
Maneesh

Die_Another_Day wrote:
Range("A:B").NumberFormat= "@"

HTH

Die_Another_Day

Phaedrus wrote:
Hi,

I'm copying a some numerical -codes into a range (say "A:B"), some of
the codes starts with a zero so, after copy Excel converts them numbers
and removes the leading zero.
This is creating a slight problem in my program.

If anybody knows a way to format the range as Text or String, using VBA
in a macro, please let me know.

I cannot do the excel formatting and save the sheet coz' the sheet is
created based on certain user-input.

Thanks in Advance,
Maneesh Hari


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default format cells as "Text"

Maneesh, An easy way to figure out formatting is to change it manually in
Excel, select the cell then type ?ActiveCell.NumberFormat in the immediate
window in the VBA editor. Glad to be of help to you.

Die_Another_Day

"Phaedrus" wrote in message
oups.com...

DAD :),

this option works perfect. (I was trying with = "Text" and it was
giving me garbage data)

thanks for your help. Really appreciate it.
Maneesh

Die_Another_Day wrote:
Range("A:B").NumberFormat= "@"

HTH

Die_Another_Day

Phaedrus wrote:
Hi,

I'm copying a some numerical -codes into a range (say "A:B"), some of
the codes starts with a zero so, after copy Excel converts them numbers
and removes the leading zero.
This is creating a slight problem in my program.

If anybody knows a way to format the range as Text or String, using VBA
in a macro, please let me know.

I cannot do the excel formatting and save the sheet coz' the sheet is
created based on certain user-input.

Thanks in Advance,
Maneesh Hari




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
Combine text from multiple cells into one cell - =(A1&","&A2","&A3 mh Excel Worksheet Functions 5 July 27th 09 02:40 AM
Format changes from "General" to "Text" GARY Excel Discussion (Misc queries) 2 March 1st 09 10:18 AM
how do I format some text....."abc123" into "abc 123" [email protected] Excel Discussion (Misc queries) 3 August 8th 07 12:11 AM
cells formatted to tick when text value "Y" if or null if "N" Jay Excel Discussion (Misc queries) 7 January 13th 06 09:16 AM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 05:03 AM.

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

About Us

"It's about Microsoft Excel"