View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Hansolo Hansolo is offline
external usenet poster
 
Posts: 2
Default Range as Variable

Different depending on the the # of dimensions. Looks like you want at least
a two-dimensional array which requires a variant.

You could try either one of the following.

Sub RangeToVaiant()
'This is one way to get a selected range into a varient array.

Dim x As Variant

x = ActiveWindow.RangeSelection.Value

MsgBox UBound(x, 1)
MsgBox UBound(x, 2)


End Sub

Sub RangeToVarient2()
'This is another way to get a selected range into a varient array

Dim x As Variant
Dim WorkRange As Range

Set WorkRange = Selection
x = WorkRange

MsgBox UBound(x, 1)
MsgBox UBound(x, 2)
End Sub
--
May the force be with you!


"lwm" wrote:

I want to take the current range and assign it to a variable touse in
additional functions.

How do I assign the current range to a variable like X?

Thanks