Attn Alan Bedan re arrays

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

I am selecting a table on a worksheet, making it active and then using
the Selection.array (I did find how to do this in the help files a few
days ago BUT didn't make a note of it, now I cannot find it again.)
I though it was 'Selection.array'

Gary
 
Dim vArr as Variant
vArr = Selection.Value
for i = 1 to ubound(varr,1)
for j = 1 to ubound(varr,2)
msgbox "vArr(" & i & ", " & j & ")=" & vArr(i,j)
next
next
 
It pointed me in the right direction, At least of got a starting point
thankyou (some of the bits in there I didnt understand (Why the &
signs?)
and Does it need to be called vArr could I call it somethin like Groups?

Thankyou for your help so far

Gary
 
You can call it anything you want as long as you dim it as variant as shown.

The ampersands build a string to help you see what is contained in each
element of the array. It has nothing to do with functionality. It is an
example. All you need is

Dim Groups as Variant
Groups = Selection.Value

Assuming Selection is a single area range.
 
Gary said:
I am selecting a table on a worksheet, making it active and then using
the Selection.array (I did find how to do this in the help files a few
days ago BUT didn't make a note of it, now I cannot find it again.)
I though it was 'Selection.array'

Gary

You didn't articulate what it is you're trying to do. Did Tom Ogilvy's
second post in this thread solve your problem?

Alan Beban
 
Tom said:
You can call it anything you want as long as you dim it as variant as shown.

The ampersands build a string to help you see what is contained in each
element of the array. It has nothing to do with functionality. It is an
example. All you need is

Dim Groups as Variant
Groups = Selection.Value

Assuming Selection is a single area range.
And if Selection is a multi-area range, if the functions in the freely
downloadable file at http://home.pacbell.net/beban are available to your
workbook and you are using Excel 2000 or later

Dim Groups()
Assign Selection, Groups

will load the value from the selected range into a one-dimensional
array, Groups.

Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top