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,073
Default Resize and Transpose question.

Range("A2").Resize(22,4) represents the range A2:D23.
I've got a 4 row by 22 column variant array (vaNeedToBuy) and I was
expecting to be able to get it into place on the worksheet as a 22 row
by 4 column range using Resize and Transpose like this...

Me.Range("A2").Resize(UBound(vaNeedToBuy, 2), UBound(vaNeedToBuy,
1)).Value _
= WorksheetFunction.Transpose(vaNeedToBuy)

However, instead, the range occupied by the data is B3:D23 with the
final row and final column missing. To get all the data I've used
vaNeedToBuy+1 in both UBound's

To get the data correctly in place I've used four steps...

1. Place it on the sheet using ....

Me.Range("A2").Resize(UBound(vaNeedToBuy, 2) + 1, _
UBound(vaNeedToBuy, 1) + 1).Value _
= WorksheetFunction.Transpose(vaNeedToBuy)

2. Use a new variant array to store the transposed data...

vaNeedToBuy2 = Range("B3:E" & UBound(vaNeedToBuy, 2) + 2)

3. Clear the transposed data off the sheet...

Range("B3:E" & UBound(vaNeedToBuy2, 1) + 2).ClearContents

4. Place the transposed data in place from the new variant array...

Me.Range("A2").Resize(UBound(vaNeedToBuy2, 1), _
UBound(vaNeedToBuy2, 2)).Value = vaNeedToBuy2


I had no luck with Cut Destination:= etc with .Offset(-1,-1) at the
end.

Is the original problem caused by the Worksheetfunction.Transpose?
Is there any easier solution to getting the transposed array correctly
in place?

Ken Johnson

 
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
resize question Gary Keramidas Excel Programming 2 October 10th 05 09:29 PM
Further Question about Transpose Florence Excel Worksheet Functions 3 June 6th 05 06:58 AM
New Range resize Question Ray Batig Excel Programming 5 September 7th 04 02:49 AM
Resize Range Question Ray Batig Excel Programming 3 August 31st 04 02:26 AM
Resize and a question a Excel Programming 6 December 2nd 03 03:01 PM


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