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: 175
Default Writing an array(2d) of user types to a worksheet

What is the "fast" way to write out a 2d-array of user defined types to a
worksheet.

I.E.
User type is a record of 10 fields. Which has 30 rows...

Type UT
field1 as string
field2 as string ....
field10 as string
end type
Dim myUDTarray () as UT
....
ReDim Preserve myUDTarray(ubound(myUDTarray) + 1) 'adds a row
myUDTarray(ubound(myUDTArray)).field1 = "v1"
....
myUDTarray(ubound(myUDTArray)).field10 = "v10"

Using the set rng = range("a1").cells
then copying myUDTarray(x).each field...to the rng.offset(x,y).value in a
loop is extremely slow.

what are some other options?

When I try to write code that uses variant arrays I get a comple error that
says my user type must be in a public module... but I do not want the type
"public" it is used ONLY in this one module.. however... what is the
statement that I would put at the top of the module to allow me to assign the
usertype'd array to a worksheet range.

If there is some way to build a valid variant array from my user type,
perhaps that would work.

Ideas?


--
Regards,
John
 
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
Issue writing IF OR Error Formula Types lozzam New Users to Excel 1 October 26th 06 08:14 AM
Writing values to worksheet from array interstellar Excel Programming 6 September 12th 05 07:00 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
Unable to add user-defined data types to a collection Adrian[_7_] Excel Programming 3 July 14th 04 08:01 PM


All times are GMT +1. The time now is 02:03 PM.

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"