View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Input box, find number and go to cell

Hi
Thank you for your suggestion that (almost) seems to work.
Still, there is a little problem:

Let's say I have the following numbers in column A

4444
404
43
4

If I carry out a search for the number "4" the macro goes to the first cell
containing the digit "4"
In this instance 4444

Can this issue be solved and also, is it possible to have the search result
as active cell?

Regards,
Kaj Pedersen


Sub FindNumber()
Dim NumToFind, rng As Range

NumToFind = Application.InputBox("Enter the number to find", Type:=1)
If NumToFind = False Then Beep: Exit Sub

Set rng = Range("A:A").Find(NumToFind, LookIn:=xlValues, LookAt:=xlWhole)
If rng Is Nothing Then
MsgBox "The number was not found"
Else
ActiveWindow.ScrollRow = rng.Row
End If
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion