LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 200
Default Array to Range assignments behave different going horizontallyand vertically

I was responding to the Op's question in his posting on 5/28/07 at 5:59:

"Is it possible to create a vertical array?" to which I thought you were
responding.

Wouldn't your code, then, load a vertical range rather than create a
vertical array?

Alan Beban

JE McGimpsey wrote:
Not sure I understand what you're doing...

Your code doesn't Dim or Set r, so I would expect an "Object required"
error (assuming no Option Explicit, which I always use).

I'd expect the "Object variable...not set" error if you inserted either
Dim statement, since, again, the code doesn't actually Set r to a range.

The OP's code set the r range object variable to a range of cells before
trying to assign the variant containing the array to r.Value:

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


I was giving a suggestion only for the line after that...



In article ,
Alan Beban <unavailable wrote:

xl2002. I ran

Sub abtest3()
v = Array(2, 4, 8)
s = Array(2, 8, 11)
r.Value = Application.Transpose(v)
'Range("a1:a3") = Application.Transpose(v)
'Range("b1:b3") = Application.Transpose(s)
End Sub

If I insert Dim r as Range or Dim r as Object at the begining I get the
"Object variable or With block variable not set" error

Alan Beban



 
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 12:27 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"