View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Index on a selection

If it's a single area:

dim MyLastCell as range

with selection
set mylastcell = .cells(.cells.count)
end with

No need to loop through all the cell.

"[KiO] ASamarcos" wrote:

Hi folks.

First time here, hope you can help me.

I'm trying to get a index on a for each next routine but I don't know
how to do it. Like the Item method. In the example I want the statement
to run on the last cell of the selection.

Example:

Sub Example()
For each cell in selection

if cell.index = selection.count then
statement
endif

next

end sub

Thanks for any help you can give.

Best regards,
KiO

--
[KiO] ASamarcos
------------------------------------------------------------------------
[KiO] ASamarcos's Profile: http://www.excelforum.com/member.php...o&userid=37554
View this thread: http://www.excelforum.com/showthread...hreadid=571874


--

Dave Peterson