ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find First Cell without a Certain Value (https://www.excelbanter.com/excel-programming/419012-find-first-cell-without-certain-value.html)

RyanH

Find First Cell without a Certain Value
 
This code works fine, I just wanted to put this out there to see what other
people use. Is there a faster more efficient way to return the row number of
the first row that does not contain "Archive" or "Ready" in Col.M?


' find first row without Archive or Ready
lngFirstRow = 3
Do While .Cells(lngFirstRow, "M") = "Archive" Or .Cells(lngFirstRow,
"M") = "Ready"
lngFirstRow = lngFirstRow + 1
Loop
--
Cheers,
Ryan

JLGWhiz

Find First Cell without a Certain Value
 
I don't know if this is faster, but it is another way to loop through and
find the cell.

For Each c In Range("M2:M" & Cells(Rows.Count, 13). _
End(xlUp).Row)
If c.Value < "Archive" And c.Value < "Ready" Then
fRng = c.Address
MsgBox c.Address
Exit For
End If
Next

"RyanH" wrote:

This code works fine, I just wanted to put this out there to see what other
people use. Is there a faster more efficient way to return the row number of
the first row that does not contain "Archive" or "Ready" in Col.M?


' find first row without Archive or Ready
lngFirstRow = 3
Do While .Cells(lngFirstRow, "M") = "Archive" Or .Cells(lngFirstRow,
"M") = "Ready"
lngFirstRow = lngFirstRow + 1
Loop
--
Cheers,
Ryan



All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com