Match exact two cells in same row and delete. -Please Help

Hatcheda

Active Member
Joined
Dec 8, 2005
Messages
354
Hey, I am kinda new at this. I am learning the program quickly but am stuck on this issue. Heres the situation. I am using a macro in Excel to import information from a varity of reports. I then import the Excel sheet into an Access database that stores and reexports the data in a varity of forms. If the info has an error when imported from excel I run into major problems. Duplicate info can not exsist. Information is only imported once a month and is always dated the first of the month. I would like a macro that will search for exact information in two cells.

example
reference---other data---other data---date
12344-------varies--------varies--------09/01/2005
12344-------varies--------varies--------09/01/2005
12345-------varies--------varies--------12/01/2005
12345-------varies--------varies--------12/01/2005

12344-------varies--------varies--------10/01/2005
12344-------varies--------varies--------10/01/2005
12344-------varies--------varies--------11/01/2005
12344-------varies--------varies--------12/01/2005
12345-------varies--------varies--------12/01/2005

I will use what ever I am given in for Access data base with two text boxes. The first I will type in the Reference # and in the second, the date.

12345 12/01/2005 in the boxes will delete all that have those values in them. The macro should be based off rows, I think. and only delete rows that match both text boxes. -no non matching rows above or below. The reference # and date may appear many times. 20+ and are not always in order. Also there may be spaces in some rows. I need an exact match to what I enter. only deleting what I enter. -very, very important. I can point the macro to the text boxes and assign a button. also this will need to work on 6 tables with one click. The button will be in a form and will need to point to 6 tables. Also the row will need to shift up. not just clear the cells because the other data in the row varies and will still cause errors once I reimport. Please help if you can. -Thanks David
Code:
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi

So you want to delete the rows of data where the reference and date match the selection criteria? And where are the 6 tables you mention? Are they on the same sheet, or in different sheets in the workbook? Where are the cells containing the selection critieria for deletion?


Tony
 
Upvote 0
the same info will be on 6 sheets. I will modify the code to find them. They are in an Access Database on different tables. Yes I do want to delete the rows of data that contain only both exact entries. the reference number will exsist for every month several time, so I need it to focus on only the months I specify. 11/1/2005, or what ever that may be. Mth, Date, Year. But it could work as a text search because I will write it exactly. the cells are in column 1 and 4. ref and date. the two in the middle change and are not searchable. I just need to locate ref and date exactly on every post and delete them. they may/will be mixed in with others. mostly I just need to know how to search two cells on a row at once, if column one matches text box one and column four matches text box two then delete. please help if you can
 
Upvote 0
A couple of other questions.

1) Confirm that this is being run in Excel, not access
2) Where are the textboxes? Are they on a particular sheet on the workbook, or in a userform?
3) What are the names of the textboxes and the relevant sheets (if in excel).


Tony
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,179
Members
448,871
Latest member
hengshankouniuniu

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