Problem selecting cell
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 |
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 |
Problem selecting cell
Tom
Thanks, that works perfectly On Tue, 15 Jun 2004 22:05:29 -0400, "Tom Ogilvy" wrote: 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 |
All times are GMT +1. The time now is 10:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com