Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
load addresses of selected cells into array
I want to physically select non-adjacent rows (alt-left button) in a
worksheet and load the adresses into an array... example: select "a1", "b6", "c4" and end up with an array: 1 1 6 2 4 3 thanks for any help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
load addresses of selected cells into array
I did not mean "ROWS", I meant to to say "CELLS)
thanks, galefly |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
load addresses of selected cells into array
Dim v as Variant, i as Long
redim v(1 to selection.count, 1 to 2) i = 1 for each cell in selectin v(i,1) = cell.Row v(i,2) = cell.column i = i + 1 Next -- Regards, Tom Ogilvy "galefly" wrote in message oups.com... I did not mean "ROWS", I meant to to say "CELLS) thanks, galefly |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
load addresses of selected cells into array
Tom,
thanks.. it bombed on CELL, "variable not defined" |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
load addresses of selected cells into array
Option Explicit
Sub testme() Dim v As Variant, i As Long Dim cell As Range ReDim v(1 To Selection.Count, 1 To 2) i = 1 For Each cell In Selection v(i, 1) = cell.Row v(i, 2) = cell.Column i = i + 1 Next End Sub galefly wrote: Tom, thanks.. it bombed on CELL, "variable not defined" -- Dave Peterson |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
load addresses of selected cells into array
Dim v as Variant, i as Long
Dim cell as Range ' <== redim v(1 to selection.count, 1 to 2) i = 1 for each cell in selection '<== selection misspelled v(i,1) = cell.Row v(i,2) = cell.column i = i + 1 Next -- Regards, Tom Ogilvy "galefly" wrote in message oups.com... Tom, thanks.. it bombed on CELL, "variable not defined" |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
load addresses of selected cells into array
Thanks guys... I caught the spelling error and changed it but still had
the problem... I surely managed to accidently slip and mess up something else in that tiny snippet of code..It works like a charm. I have done a lot of VBA programming (mosty ACCESS) but very little in EXCEL. I am having a bit of a problem getting a handle on the objects.. There seems to be 80 ways to do anything. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Variable range addresses for use in array functions | Excel Discussion (Misc queries) | |||
Load a static array at procedure level | Excel Programming | |||
Load excel range into multi dimensional array | Excel Programming | |||
Load an array with Sheet names | Excel Programming | |||
array filling: cell addresses | Excel Programming |