View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Hagan Jim Hagan is offline
external usenet poster
 
Posts: 10
Default Looping over non-contiguous column selection

I'd like to loop over all columns (or rows) in a non-contiguous selection in
one of my macros.

I can already do it rather easily for a contiguous column selection by
referencing the Selection.Column property and the Selection.Columns.Count
property as in the following ...

'get DataColumn information
FirstDataColumn = Selection.Column
LastDataColumn = FirstDataColumn + Selection.Columns.Count - 1
For k = FirstDataColumn To LastDataColumn
....
next k

I'd like to do the same thing for a non-contiguous column/row selection.

Any help would be greatly appreciated.

Thanks,

Jim