Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Writing Out Numbers as Text

I have an array that contains several items.
Some are pure text, some are numbers as text, and some are numbers.

I assign the array to a range using:

Set myRange = Range(.......
myRange.Select
myRange = myArray

However, when I do this the items that are numbers as text are
converted back to numbers. I don't want this as its important they be
numbers as text because our ERP system understands those to be things
like division, department, location, etc. identifiers and numbers and
numbers to be $ or people. How can I keep VB from converting them to
numbers during the assignement?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Writing Out Numbers as Text


It will not convert it you READ,
it may convert when you WRITE to cells.

if you must write TEXT
either: (preferred option)
format the cell as "@" text numberformat
before you assign it's value
or:
prefix the value with an apostroph.


Sub Foo()
Dim aValue as variant ,itm as Variant
Range("a1").numberformat ="@"
Range("a2").numberformat ="General"
Range("a3").numberformat ="0"
Range("a1:a3").Value = array("1234","'1234",1234)

aValue = Range("a1:a3").Value
For Each itm In aValue
Debug.Print TypeName(itm)
Next

End Sub.



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


" wrote:

I have an array that contains several items.
Some are pure text, some are numbers as text, and some are numbers.

I assign the array to a range using:

Set myRange = Range(.......
myRange.Select
myRange = myArray

However, when I do this the items that are numbers as text are
converted back to numbers. I don't want this as its important they be
numbers as text because our ERP system understands those to be things
like division, department, location, etc. identifiers and numbers and
numbers to be $ or people. How can I keep VB from converting them to
numbers during the assignement?



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
Turn numbers into words to automate check-writing TONY M Excel Discussion (Misc queries) 3 February 28th 07 08:31 PM
Turn numbers into words to automate check-writing Mike Excel Discussion (Misc queries) 0 February 28th 07 02:18 PM
How do I convert numbers to words writing checks with Excel? Pablo Excel Worksheet Functions 4 December 12th 05 08:12 PM
How do I spell numbers as words for writing checks in Excel? Heather Excel Worksheet Functions 1 March 11th 05 08:47 PM
Writing 2 macros to sort names and numbers in excel 97 Paul Excel Programming 1 November 2nd 03 10:58 PM


All times are GMT +1. The time now is 07:47 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"