Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Array to Range assignments behave different going horizontally and vertically

The following sub creates

1
1
1

Sub test()
Dim b As Workbook
Dim s As Worksheet
Set b = ThisWorkbook
Set s = b.Sheets("Sheet1")
s.Activate
Dim v
v = Array(1, 4, 6)
Dim r As Range
Set r = s.Range(s.Cells(1, 1), s.Cells(3, 1))
r.Value = v
End Sub

When I change the r assignment to

Set r = s.Range(s.Cells1,1),s.Cells(1,3)

I get

1 4 6

What is the logic in Excel that makes it treat horizontal assignments
different from vertical ones?

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Array to Range assignments behave different going horizontally and

What is it you want to do and we can help.

" wrote:

The following sub creates

1
1
1

Sub test()
Dim b As Workbook
Dim s As Worksheet
Set b = ThisWorkbook
Set s = b.Sheets("Sheet1")
s.Activate
Dim v
v = Array(1, 4, 6)
Dim r As Range
Set r = s.Range(s.Cells(1, 1), s.Cells(3, 1))
r.Value = v
End Sub

When I change the r assignment to

Set r = s.Range(s.Cells1,1),s.Cells(1,3)

I get

1 4 6

What is the logic in Excel that makes it treat horizontal assignments
different from vertical ones?

Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Array to Range assignments behave different going horizontally and vertically

Thanks Alan,

Is it possible to create a vertical array?

On May 28, 5:47 pm, Alan Beban <unavailable wrote:
In the first case you are trying to enter a horizontal array into a
vertical range.

Alan Beban


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Array to Range assignments behave different going horizontally and vertically

One way:

r.Value = Application.Transpose(v)

In article .com,
"
wrote:

Is it possible to create a vertical array?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 200
Default Array to Range assignments behave different going horizontallyand vertically

For me this throws an "Object required" error.

r = Application.Transpose(v) works

Alan Beban

JE McGimpsey wrote:
One way:

r.Value = Application.Transpose(v)

In article .com,
"
wrote:

Is it possible to create a vertical array?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Array to Range assignments behave different going horizontally and vertically

Hmm... what version of XL?

Is r not defined as an object, or is it Application?

r.Value = Application.Transpose(v)

works fine for me in XL04 when plugged into the OP's code.

In article ,
Alan Beban <unavailable wrote:

For me this throws an "Object required" error.

r = Application.Transpose(v) works

Alan Beban

JE McGimpsey wrote:
One way:

r.Value = Application.Transpose(v)

In article .com,
"
wrote:

Is it possible to create a vertical array?

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
Can I arrange tabs vertically in Excel (not horizontally)? LinLin Excel Discussion (Misc queries) 14 May 2nd 17 08:04 PM
Looking up for value vertically and horizontally simultaneously Sanjeev Raghavan[_2_] Excel Worksheet Functions 1 March 6th 10 12:59 PM
how to search vertically then count horizontally in excel Novawitt Excel Worksheet Functions 2 December 14th 08 04:19 AM
Move cells vertically to horizontally Abe Excel Discussion (Misc queries) 1 March 23rd 05 02:57 AM
Checkbox - Center Horizontally and Vertically _SPCA Excel Programming 0 December 10th 04 10:37 PM


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