Search string issues

touyets

New Member
Joined
Jun 21, 2005
Messages
16
Hi there.

here's the deal:
I have a file with a main userform that activates when the workbook is opened. On that userform, we have 2 options: "Creating an Entry" and "Replacing an "entry". I have done all the VBA code for the "creating an Entry" and it works perfectly but now I need to do some stuff that I have never done on VBA before:

Basically what I want it to do:

A new userform opens with several fields:
"reference number" input text-box (name= RefReplaceNew)
"title" input text-box (name= TitleReplaceNew)
"Category" input text-box (name= CategoryReplaceNew)

and then underneath another "reference number" (name= RefReplaceOld ) input text-box but this time for the data I want to replace in the database.

ALL OF THE ABOVE IS ALREADY DONE!

The problems start here:
I need Excel to search and find (hopefully) the second "reference number" in the column A (more than 3.000 entries) and then save the info from column A,B and C of that line (a simple 3 line variable with x = something; y = something and z = something should be enough to do that)
Then having saved that information, input in column A the information from RefReplaceNew), B the info from TitleReplaceNew) and in C info from CategoryReplaceNew.

then I need it to go to the first empty cell in column A and input the saved info from x in B the saved info y and in C the info in z.

-----------------------------------------------------------------

Also, one Massive thing: in the search engine, I need to be able to find the EXACT PHRASE as it will be a number I will be looking for and if I am looking for nuumber 123, I don't want it to choose 1234 if it has the chance.

And another thing: i want it to be able to say that I did not find such number if it didn't...

this is what I came up with for the search code

Dim cel As Range
Set cel = Range("A:A").Find(RefReplaceOld, LookAt:=xlPart)
If Not cel Is Nothing Then Cells(cel.Row, 1).Select


Any ideas?
 

Some videos you may like

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.

Watch MrExcel Video

Forum statistics

Threads
1,122,509
Messages
5,596,566
Members
414,078
Latest member
Frills

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
Top