LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Transpose Function not Working with Long Array Elements

Why. I suspect it has to do with the origins of excel. In versions of
excel prior to xl97, text was limited to 255 characters. In xl97, they
added a storage mechanism to store larger strings - up to 32K. However, the
"record" or data structure used to maintain information about the cell still
stores the first 255 characters only. Also, 255 is the max value stored in
8 bits/1 word, so I suspect many structures related to strings only allow a
length of 255 - until the core excel code is rewritten, I suspect
limitations like this will continue to exist.

--
Regards,
Tom Ogilvy


"Ngan" wrote in message
...
Hi,
Attached is a simple Macro I wrote to basically paste an array of strings
into a range of cells. If the array elements ("String" data type) are

less
than or equal to 255 characters long, the macro works. If the array

elements
are more than 255 characters in length, I'll get the following error:
"Run-time error '-2147417848 (800101088): Method 'Transpose' of object
WorksheetFunction failed"

It does not matter how many elements the array has; it's all about the
element length, which is so bizzare. Does anyone know why?

I've searched everywhere for an answer to this weird problem, but no luck

so
far.

Thanks for your help in advance! In the code below, the array elements

are
exactly 255 characters long, and the macro should work fine. If you just

add
1 more character to those elements, the macro will crash.

===========================================
Sub test()
Dim testArray(0 To 1) As String
Dim xlap As Excel.Application
Dim wks As Worksheet

Set xlap = Application
Set wks = xlap.ActiveSheet

testArray(0) =

"1234567890123456789012345678901234567890123456789 01234567890123456789012345
67890123456789012345678901234567890123456789012345 67890123456789012345678901
23456789012345678901234567890123456789012345678901 23456789012345678901234567
8901234567890123456789012345"
testArray(1) =

"1234567890123456789012345678901234567890123456789 01234567890123456789012345
67890123456789012345678901234567890123456789012345 67890123456789012345678901
23456789012345678901234567890123456789012345678901 23456789012345678901234567
8901234567890123456789012345"

wks.Cells(1, "A").Resize(2).Value =
xlap.WorksheetFunction.Transpose(testArray)

Set wks = Nothing
Set xlap = Nothing
End Sub



 
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
How fix a too long array function KalleH Excel Worksheet Functions 5 August 24th 09 04:55 PM
Use formulas for array elements hmm Excel Discussion (Misc queries) 3 December 3rd 07 01:15 PM
Countif array function not working ub Excel Worksheet Functions 5 September 26th 07 03:39 PM
Non-unique elements in an array Andrew Excel Discussion (Misc queries) 1 August 22nd 05 11:58 AM
Count elements in array Jason Morin[_3_] Excel Programming 7 January 31st 05 09:32 PM


All times are GMT +1. The time now is 12:02 AM.

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"