Seek

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
I want to write a macro that first give me the possibility to enter a message in a text box and then give me the active cell.
Ex. I have 700 lines in column A AAA
BBB
CCC
DDD
etc..

When I can give in a textbox DDD than the program goes automatickly to line 4 with the text DDD
Have anyone such a macro?
Many thanks.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
On 2002-03-29 05:49, verluc wrote:
I want to write a macro that first give me the possibility to enter a message in a text box and then give me the active cell.
Ex. I have 700 lines in column A AAA
BBB
CCC
DDD
etc..

When I can give in a textbox DDD than the program goes automatickly to line 4 with the text DDD
Have anyone such a macro?
Many thanks.

Hi,
I am far from being an expert in VBA but I tried this and it seems to work, although maybe it needs some polish:

Sub SeekValue()
Range("A1").Select
ABC = InputBox("Enter value to seek ")
Cells.Find(What:=ABC, After:=ActiveCell).Activate
End Sub

Regards,
Eli
This message was edited by eliW on 2002-03-29 07:14
 
Upvote 0
On 2002-03-29 06:42, eliW wrote:
On 2002-03-29 05:49, verluc wrote:
I want to write a macro that first give me the possibility to enter a message in a text box and then give me the active cell.
Ex. I have 700 lines in column A AAA
BBB
CCC
DDD
etc..

When I can give in a textbox DDD than the program goes automatickly to line 4 with the text DDD
Have anyone such a macro?
Many thanks.

Hi,
I am far from being an expert in VBA but I tried this and it seems to work, although maybe it needs some polish:

Sub SeekValue()
Range("A1").Select
ABC = InputBox("Enter value to seek ")
Cells.Find(What:=ABC, After:=ActiveCell).Activate
End Sub

Regards,
Eli
Yes,it works.But what if the program don't find it,or is does not exist?Can the program me give a message: "Can't find it !!!"
Many thanks
This message was edited by eliW on 2002-03-29 07:14
 
Upvote 0
Just change Eli's code to;

Sub SeekValue()
Dim abc

Range("A1").Select
abc = InputBox("Enter value to seek ")
On Error Resume Next
Cells.Find(What:=abc, After:=ActiveCell).Activate
If Err Then MsgBox abc & " Not found!"

End Sub


Ivan
 
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,559
Latest member
MrPJ_Harper

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top