View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Move active cell through current selection


use a for each something like this...

Dim rng as Range
'Get Excel instances
Set a = GetObject(, "Excel.Application")

for each rng in a.Selection
rng.value = rng.address
next rng
--
HTH...

Jim Thomlinson


"Mike King" wrote:

Is there a way to move the active cell through the current selection using
an external program? I'm trying to get a data capture program I have
written to update the active worksheet's cells. I would like the user to
select the cells to be updated, then my program will hopefully update the
active cell then move to the next cell in the selection the same way the tab
key does.

The following code shows my problem. The Goto method changes the selection
and doesn't do the same thing the tab key does.

' Get Excel instances
Set a = GetObject(, "Excel.Application")

' Set text of active cell
e.ActiveCell.Value = "Hello, World!"

e.Goto e.ActiveCell.Next