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: 2,059
Default How to return Array() to range as variable?

The following does what I want:

Sub testit()
Range("b2:d2") = Array(21, 22, 23)
End Sub

But I would prefer to use a variable instead of Range("b2:d2"). (Part of a
larger macro.)

Why doesn't the following work? More importantly, how can I make it work?

Sub testit()
Dim rng
Set rng = Range("b2:d2")
rng = Array(21, 22, 23)
End Sub

 
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
Return a range based on a variable Art Excel Worksheet Functions 4 December 18th 09 11:08 PM
Return actual range not cell value in variable Richhall[_2_] Excel Worksheet Functions 1 September 18th 09 02:34 PM
Return a value if variable is in a range plally Excel Discussion (Misc queries) 3 October 23rd 08 08:27 PM
can .range return a 1D array? Bruce Bowler Excel Programming 14 May 18th 08 08:54 AM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM


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