Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Moving range to array

Hi,

I can move a 2D array to a range but how do I move a selected range to a 2D
array?

Dim MyGrid() As String

Range("A9").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
MyGrid = Selection.Text

(or)

MyGrid = Range("B2:D5").Text

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Moving range to array

Dim MyGrid()


MyGrid = Range("B2:D5")

works for me

--
HTH

Bob Phillips

"Charlie" wrote in message
...
Hi,

I can move a 2D array to a range but how do I move a selected range to a

2D
array?

Dim MyGrid() As String

Range("A9").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
MyGrid = Selection.Text

(or)

MyGrid = Range("B2:D5").Text

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Moving range to array

What problem are you having?

If it is type mismatch, use .Value instead of .Text and replace 'As
String' with 'As Variant'.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hi,

I can move a 2D array to a range but how do I move a selected range to a 2D
array?

Dim MyGrid() As String

Range("A9").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
MyGrid = Selection.Text

(or)

MyGrid = Range("B2:D5").Text

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Moving range to array

Charlie,

To add to Bob's post...
You cannot assign to an array in Excel 97.
In later versions you must use the Value property of the
range not the Text property, so...
MyGrid= Range("B2:D5").Value

Jim Cone
San Francisco, USA



"Charlie" wrote in message
...
Hi,
I can move a 2D array to a range but how do I move a selected range to a 2D
array?
Dim MyGrid() As String
Range("A9").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
MyGrid = Selection.Text
(or)
MyGrid = Range("B2:D5").Text
Thanks
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Moving range to array

Dim MyGrid as Variant
MyGrid= Range("B2:D5").Value

works fine for me in Excel 97.

Dim MyGrid() as Variant
MyGrid= Range("B2:D5").Value

doesn't work in Excel 97, VBA5

--
Regards,
Tom Ogilvy


"Jim Cone" wrote in message
...
Charlie,

To add to Bob's post...
You cannot assign to an array in Excel 97.
In later versions you must use the Value property of the
range not the Text property, so...
MyGrid= Range("B2:D5").Value

Jim Cone
San Francisco, USA



"Charlie" wrote in message
...
Hi,
I can move a 2D array to a range but how do I move a selected range to a

2D
array?
Dim MyGrid() As String
Range("A9").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
MyGrid = Selection.Text
(or)
MyGrid = Range("B2:D5").Text
Thanks





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Moving range to array

Thanks all, it was the array declaration that held me up.

"Tom Ogilvy" wrote:

Dim MyGrid as Variant
MyGrid= Range("B2:D5").Value

works fine for me in Excel 97.

Dim MyGrid() as Variant
MyGrid= Range("B2:D5").Value

doesn't work in Excel 97, VBA5

--
Regards,
Tom Ogilvy


"Jim Cone" wrote in message
...
Charlie,

To add to Bob's post...
You cannot assign to an array in Excel 97.
In later versions you must use the Value property of the
range not the Text property, so...
MyGrid= Range("B2:D5").Value

Jim Cone
San Francisco, USA



"Charlie" wrote in message
...
Hi,
I can move a 2D array to a range but how do I move a selected range to a

2D
array?
Dim MyGrid() As String
Range("A9").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
MyGrid = Selection.Text
(or)
MyGrid = Range("B2:D5").Text
Thanks




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
Moving range? wx4usa Excel Discussion (Misc queries) 7 December 26th 09 04:28 PM
Prevent cell/array references from changing when altering/moving thecell/array nme Excel Discussion (Misc queries) 1 September 19th 08 01:53 PM
sum with moving range snax500 Excel Discussion (Misc queries) 3 July 10th 06 05:56 AM
RTD w/Array Formula fails when moving to new PC [email protected] Excel Programming 0 April 19th 05 08:02 PM
Moving Array formulas from spreadsheet to VBA John Pierce Excel Programming 5 August 1st 03 03:38 AM


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