Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default load addresses of selected cells into array

I did not mean "ROWS", I meant to to say "CELLS)
thanks, galefly

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default load addresses of selected cells into array

Tom,

thanks.. it bombed on CELL, "variable not defined"

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
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
Variable range addresses for use in array functions NickCory Excel Discussion (Misc queries) 3 September 11th 06 11:00 PM
Load a static array at procedure level XP Excel Programming 1 March 10th 06 04:27 PM
Load excel range into multi dimensional array Rishi Dhupar Excel Programming 1 January 26th 06 03:50 PM
Load an array with Sheet names S G Booth Excel Programming 6 March 2nd 05 08:48 PM
array filling: cell addresses Peter[_21_] Excel Programming 3 November 21st 03 08:55 PM


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