View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Francis Hookham Francis Hookham is offline
external usenet poster
 
Posts: 125
Default Find in a column

Thanks Norman for the TextBox deletion answer - it was just what I wanted

This problem just shows up how little I know - I do not know how to make
your suggestion work. It's late and I'm old and tired and have tried
unsuccessfully to set out below a Sub which would crudley do what I am
trying to do - it does not work but it might show what I want - please!

Thanks
Francis

Sub FindRowNum()
Sheets("Specs").Select
'find extent of col 1
LastUsedRow = Cells(Rows.Count, 1).End(xlUp).Row
'start in row 2
Cells(2, 1).Select
'number to be found
NumToFind = InputBox("Find which number?")
'loop to stop at LastUsedRow
While ActiveCell.Row <= LastUsedRow
'loop to step down column
While ActiveCell.Value < NumToFind
ActiveCell.Offset(1, 0).Select
Wend
RowNum = ActiveCell.Row
Wend
End Sub


"Norman Jones" wrote in message
...
Hi Francis,

Try something like:

'============
Dim RngFound As Range
Const sSearchString As String = 44 '<<==== CHANGE

Set RngFound = rng.Find(What:=sSearchString, _
After:=rng.Cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

If Not RngFound Is Nothing Then
'do something, e.g:
MsgBox RngFound.Row
End If
'<<============
---
Regards,
Norman



"Francis Hookham" wrote in message
...
In a subroutine I need to find which row where a specific numeral occurs
in a column A. numbers will start in A4 and there may be blank cells in
the column.



The Module already has the following

LastUsedRow = Cells(Rows.Count, 1).End(xlUp).Row

to find the range:

Range(cells(4,1),cells(LastUsedRow,1))



How do I carry on from there to find NumberRow?



Thanks



Francis Hookham