View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Problem selecting cell

For Each cell In rPassedRange
If (cell.Value 0) Then
cell.Select
Set rNextCell = cell.End(xlDown)
MsgBox cell.Address & " - " & rNextCell.Address
End If
Next

--
Regards,
Tom Ogilvy


wrote in message
...
rPassedRange consists of a row of cells.

I want to go through each cell, and when a value is found, I want to
select down to find the next cell in that column that has a cell with
a value.

Can someone tell me what I am doing incorrectly?

thanks

For Each cell In rPassedRange
If (cell.Value 0) Then
cell.Select
cell.Activate
'I get the address of the cell that I expect here.
'however it dopes not seem to be active
MsgBox cell.Address
Selection.End(xlDown).Select
Set rNextCell = Selection
'here I am getting what ever cell is active on the
worksheet rather than the next cell in the column with a value
MsgBox rNextCell.Address
End If
Next