LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Array loses data type when placed into range

I have a VB program that uses Automation to create a worksheet and
then dimension a range as large as an array Dim'ed in the VB
program... I then just set the range values equal to the array
variable... i.e. -

Set rngData = oExcel.Application.ActiveCell.Resize(UBound(arr, 1) + 1,
UBound(arr, 2) + 1)
rngData = arr

And it dumps the array into the range.

Problem: a text string from an array element like "0003334" is
interpreted as a number by excel when placed into the cell. the zeros
are considered "insignifigant" and they are removed, Just as if I had
typed the string into the cell myself.

I was thinking maybe concatenating a chr(39) to the front of the
string would cause excel to change the data type of the cell to a
string type, and left justify it in the cell, etc...

Is it o.k. to do this?
 
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
Return array of data by date range Ken King Excel Discussion (Misc queries) 1 March 3rd 09 01:13 AM
Sorting a range loses formatted borders Jim Cone Excel Discussion (Misc queries) 2 February 25th 08 07:58 PM
Q: Best way to take data from VBA into graphs without writing data to worksheets? (Can a named range refer to an array in memory only?) KR Excel Programming 2 December 16th 04 11:12 PM
range data type seanw Excel Programming 2 August 17th 04 07:46 PM
Read Range Data into Array Stratuser Excel Programming 1 April 26th 04 06:46 PM


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