Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Asign Array Variant to Column

Assigning a one dimensional variant array to cells in a row works, but when
the code assigns the array to cells in a column, each cell in the range
contains the first element from the variant array! I cannot find a way of
transposing the variant

This code works: The cells are in a row
count = UBound(answer, 1)
Range(ActiveCell, ActiveCell.Offset(0, count-1)).Formula = answer

This code assigns the first element of the variant array to each cell in
the column range.
count = UBound(answer, 1)
Range(ActiveCell, ActiveCell.Offset(count-1, 0)).Formula = answer

Is there a way of making Excel asign the elements of the array to a column?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Asign Array Variant to Column

User defined function which is to be used with an array formula:

Function testit(invalue As Integer) As Variant()
Dim varItems() As Variant, i As Long, j As Long

With Application.Caller
ReDim varItems(.Rows.Count - 1, .Columns.Count - 1)

For i = 0 To .Rows.Count - 1
For j = 0 To .Columns.Count - 1
varItems(i, j) = i * j * invalue
Next
Next
End With

testit = varItems()
End Function

"William C. Smith" <wcsmithx*xieee.org wrote in message
...
Assigning a one dimensional variant array to cells in a row works, but

when
the code assigns the array to cells in a column, each cell in the range
contains the first element from the variant array! I cannot find a way of
transposing the variant

This code works: The cells are in a row
count = UBound(answer, 1)
Range(ActiveCell, ActiveCell.Offset(0, count-1)).Formula = answer

This code assigns the first element of the variant array to each cell in
the column range.
count = UBound(answer, 1)
Range(ActiveCell, ActiveCell.Offset(count-1, 0)).Formula = answer

Is there a way of making Excel asign the elements of the array to a

column?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Asign Array Variant to Column

"William C. Smith" <wcsmithx*xieee.org wrote...
....
This code assigns the first element of the variant array to each cell in
the column range.
count = UBound(answer, 1)
Range(ActiveCell, ActiveCell.Offset(count-1, 0)).Formula = answer

Is there a way of making Excel asign the elements of the array to a column?


ActiveCell.Resize(UBound(answer), 1).Formula = _
Application.WorksheetFunction.Transpose(answer)

should work.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Asign Array Variant to Column

"Harlan*Grove" wrote in
:

Is there a way of making Excel asign the elements of the array to a
column?


ActiveCell.Resize(UBound(answer), 1).Formula = _
Application.WorksheetFunction.Transpose(answer)


Application.WorksheetFunction.Transpose(answer) works. Thank you.

Bill
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
asign a number to a text string gimme_donuts Excel Discussion (Misc queries) 7 December 24th 08 07:21 AM
asign the next 10th as the due date. slow but sure Excel Worksheet Functions 4 June 16th 08 02:23 AM
HOW TO ASIGN SAME NAME TO TWO DIFFERENT RANGES IN SEPARAT SHEETS Satyapal Kaushal Excel Discussion (Misc queries) 1 June 5th 07 01:31 PM
How can I asign a number value to a text line in Excel? AIF_GoofyDo2 Charts and Charting in Excel 0 December 6th 04 01:19 AM
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


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