Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default (Newbie) Copying values from an array to the worksheet

The catch is this: the array is 2-dimensional and it's not fixed in size, so
I can't define the worksheet range in advance.

The array is quadratic and its dimension is user defined; i.e.

ReDim varArray(varN, varN) as Integer

varN can be anywhere from 100 to 500.

Can I copy the contents of this aray to the worksheet just by refering the
anchor cell (i.e. the top-left cell)?

I've tried:

Range("A1").value = varArray

and it just pulls the varArray(1,1) value.

I've also tried

Range("A1").Offset(varN, varN).value = varArray

but the debugger reports an error (he probably doesn't recognize the object
I'm refering to).

please CC: your reply to

srdan.kovacevic(a)fsb.hr

(a) is obviously the monkey-sign (spamspoofer)

Thanks in advance!
srdan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default (Newbie) Copying values from an array to the worksheet

rws = Ubound(varArray,1)-Lbound(varArray,1)+1
cls = Ubound(varArray,2) - Lbound(varArray,2) + 1
Range("A1").Resize(rws,cls) = varArray

--
Regards,
Tom Ogilvy

"Srdjan Kovacevic" wrote in message
...
The catch is this: the array is 2-dimensional and it's not fixed in size,

so
I can't define the worksheet range in advance.

The array is quadratic and its dimension is user defined; i.e.

ReDim varArray(varN, varN) as Integer

varN can be anywhere from 100 to 500.

Can I copy the contents of this aray to the worksheet just by refering the
anchor cell (i.e. the top-left cell)?

I've tried:

Range("A1").value = varArray

and it just pulls the varArray(1,1) value.

I've also tried

Range("A1").Offset(varN, varN).value = varArray

but the debugger reports an error (he probably doesn't recognize the

object
I'm refering to).

please CC: your reply to

srdan.kovacevic(a)fsb.hr

(a) is obviously the monkey-sign (spamspoofer)

Thanks in advance!
srdan




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
Newbie: Copying row of values to a column CF Excel Discussion (Misc queries) 4 December 19th 09 07:48 PM
copying an entire worksheet - need absolute values Cowtoon Excel Worksheet Functions 1 December 12th 05 10:08 PM
Hided values appears when I'm copying/pasting it to other worksheet Aivaras_Bakanas Excel Discussion (Misc queries) 2 July 13th 05 02:18 PM
Array of Values from Worksheet Range - What does it 'look' like? Alan Excel Programming 7 July 8th 04 01:06 PM
Copying an array to a worksheet: Excel 97 vs 2000 Trevor Shuttleworth Excel Programming 1 February 17th 04 03:11 AM


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