Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fine
I need a macro, with a in put box for a number and find the number in column
A . bring number to the top of sheet. Thanks , need need help Donald E PS E-mail me with the code |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fine
This is untested, but should work, if the number is in column A.
Sub fndNbr() lr = Cells(Rows.Count, 1).End(xlUp).Row srchNbr = InputBox("Enter a number", "Number") With ActiveSheet.Range("A2:A" & lr) Set c = .Find(srchNbr, LookIn:xlValues) If Not c Is Nothing Then Range("A1") = c End If End With End Sub "Donald E" wrote: I need a macro, with a in put box for a number and find the number in column A . bring number to the top of sheet. Thanks , need need help Donald E PS E-mail me with the code |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fine
Hi donald,
I prepared and answer and I now see someone else has answered. However, I'll post my code anyway because it is a variation on the other answer. This code cuts the number from the original location and inserts it at the top. It also allows you to continue your searches until you click cancel. Sub Macro1() Dim inputNumber As Variant Dim foundCell As Range Do inputNumber = InputBox("Enter the number to be found" & _ Chr(13) & "Cancel to exit") With Sheets("Sheet1").Columns("A") Set foundCell = .Find(What:=inputNumber, _ LookIn:=xlValues, _ LookAt:=xlWhole, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False) If foundCell.Value < "" Then foundCell.Cut .Cells(1, 1).Insert Shift:=xlDown End If End With Loop While inputNumber < "" End Sub Regards, OssieMac |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Everthing worked fine and then....... | Excel Programming | |||
1st copy prints fine, others do not | Excel Discussion (Misc queries) | |||
Macro fine Run fine from Select but not from KB Shortcut? | Excel Discussion (Misc queries) | |||
Works fine in debug, but... | Excel Programming | |||
help w/ fine tuning | New Users to Excel |