Finding A Value In A Cell And Deleting A Row
Feb 10, 2009
I'm looking to do a search and delete in Excel 2007 and I'm having a great deal of difficulty trying to do this. I've attempted to modify some code I found on the internet and not having very good luck with it. Here is the scenario, I've got a spreadsheet with 5 columns (A to E). In column C, there is a product name with certain identifiers that set it apart. An example of this product name with identifier is "product XXX_type 2_attribute ". I want to search for "type 2" in Column C of each row and then delete the row.
Here is what I have written so far and I'm not having any luck.
Sub RowDel()
Dim cell As Range
For Each cell In Range(Range("c4"), _
Range("c65536").End(xlUp))
If cell = "_GPnl_" Then
Range(cell, _
Cells(Rows.Count, 1)).EntireRow.Delete
Exit For
End If
Next cell
End Sub
View 9 Replies
ADVERTISEMENT
Jan 27, 2014
Any way of finding particular data from a data set and deleting the data from that field without using conditional formatting or remove duplicates?
I have used a vlookup to find the words that I needed I now need to find where the are located in my original data set and delete these so I am left with data that if I perform a vlookup on it will not bring back any words as they will have been deleted.
View 4 Replies
View Related
Aug 5, 2007
I deal with leads for a sales room and get sent over leads in bulk, I've created a master scrub list that I can attach to the end of a new lead file and sort by number to show which are duplicates.
When you do the: Data, Filter, Advanced Filter, select Unique Records, it hides the duplicate but what I need is not only for the duplicate to be hidden or gone but the row that it is a duplicate of, i.e. I need BOTH rows to go
Name-----number
Dave 555-1212
Dave 555-1212
John 536-2343
Smith 423-2312
needs to become
Name-----number
John 536-2343
Smith 423-2312
I would need a formula that figured out that Dave with number 555-1212 was a duplicate and delete BOTH rows,
View 10 Replies
View Related
Jul 31, 2013
I was wondering if there is a formula or command to find and delet specific rows. I want to remove people from an excel email list.
On Sheet 1, I have 500 rows with columns for first name, last name, and email.
On Sheet 2, I have 30 rows with columns for first name, last name, and email that appear on Sheet 1 but need to be removed.
Is there a way to do this without manually searching for each email and then deleting the row?
View 4 Replies
View Related
Jun 6, 2007
I have a large keyword phrase list.
In a sheet called "AllKWs".
What I would like to be able to do is find all Country and town names in that list and delete the names only in the phrase, not the whole row.
Several points though.
Can the macro (As I will assign a text button to it).
Only find and delete these words if they are either at the start or end of a phrase?
4 example phrases; ....
View 9 Replies
View Related
Jan 13, 2007
I want to delete a row in a spreadsheet by finding the row that contains a particular value. I use MATCH on spreadsheet #1 to identify the row number on spreadsheet #2 to delete. I need the macro to select the row number on spreadsheet #2 and delete it.
I don't know the syntax for the commands in VBA to write this and I'm coming to this forum for help because I'm too lazy to learn VBA. I've recorded macros to add rows, populate cells, hide sheets, etc. The following code is extracted from a macro I recorded to try to get started, and was hoping to be able to substitue a reference to sheet1 within the parentheses at
Rows("4:4").Select
but I can't make this work. The following is the code I was trying to adapt.
Sheets("Sheet2").Select
Rows("4:4").Select
Selection.Delete Shift:=xlUp
End Sub
View 4 Replies
View Related
Apr 2, 2014
I have a excel file with more then 10 sheets..Some of the sheets contains this word in some random cells" #DIV/0! " I want a macro which can find it in every sheet except parent sheet and can remove it.
View 5 Replies
View Related
Oct 14, 2009
I'm trying to create a macro that will look in each row and find the first nonzero that it contains, and then proceed to delete all prior cells before it and shift the existing cells in that row to the left. Now I know that the formula to find a non-zero in a row is:
=(MATCH(TRUE,INDEX(B9:BE9>0,0),0)-1)
and I figured that to select all cells before it you would simply use:
Range(Selection, Selection.End(xlToLeft)).Select
Selection.Delete Shift:=xlToLeft
My problemms are:
I can't figure out how to translate that formula into a piece of the macro and also instead of having it simply calculate how many zeros there are until the first nonzero to get it to select that first nonzero
How to make the selection conditional upon the row. At first I thought maybe I could just have it paste the formula into the first cell of the row but I realized that it wasn't possible to do as the formula already has the row selected
How to have it select all the prior cells to the first nonzero, delete them and shift existing cells to the left without deleting the first nonzero.
View 9 Replies
View Related
Mar 22, 2014
I have a sheet that I fill out with customer data then print and start over with the next customer. This requires me to tab and delete through the sheet before starting the next entry and I am wondering if there is some way to auto clear the unlocked cells based on a single entry IE when we entered new data in the 1st field this would clear the unlocked cells and make them ready for new data?
View 14 Replies
View Related
Mar 31, 2007
In Excel 2007, when I delete a row/cell, text is associated with deleting row/cell but some lines, polygon ... can not associate with deleting row/cell . So the lines, polygon ... in mistake location.
View 12 Replies
View Related
Oct 8, 2008
I am using this code to populate column J with a date when yes is selected in colum I.
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column = Columns("I").Column Then
If .Value = "Yes" And IsEmpty(.Offset(, 1)) Then .Offset(, 1) = Date
End If
End With
End Sub
However i also want any value entered in J to be deleted when No is selected.
View 2 Replies
View Related
Sep 21, 2006
My original datasheet had two separate columns, First Name & Last Name. I've combined the two columns into one so it appears Last Name, First Name. Some of the names have middle names. Is there anyway to delete the middle name.
Example: Cope, David Simon
Trying to get: Cope, David
View 7 Replies
View Related
May 23, 2006
I am using Excel on a work computer that someone else may have changed the settings on.
I want to simply delete a cell, without deleting the entire row the cell belongs to. Yet when I highlight the cell, and go to Edit -> Delete, the program asks me if I want to delete the entire row, and only gives me two options: OK or Cancel. So I can't delete just one cell (and have all of the lower cells shift up one).
When I right click, the 'delete' option is not present either. I tried changing the menu properties to add the 'delete' function, but it will not delete a cell without taking out the whole row.
View 3 Replies
View Related
Jun 24, 2014
I have a lot of calculations going on so I thought I would name some of the cells where factors come from to make it easier to follow.
I made a typo and named a cell wrong, is there a way to delete it? Right now I have a correct and incorrect name attached to the cell.
View 3 Replies
View Related
Feb 24, 2009
hey everyone
i'm using a table like this one :
A B C D
1 Main | value | value | value
2 Extra | value | value | value
3 Main | value | value | value
.
.
n Extra | value | value | value
i want to delete every cell in column "D" only when cell in column "A" contains "Extra" value.
View 6 Replies
View Related
Jan 28, 2010
I want to delete columns that contain a 0 value in row 2 of the column.
In my case, I have headers in row 1 and values in rows 2 and below. I eventually want to filter out the columns that contain no values below the headers.
Let me know if you need any more information for clarification.
View 10 Replies
View Related
Oct 27, 2011
I was wondering if ther is a way to delete what is in one cell, once something has been enterted in another?
Example A1 has In-progress written in the cell.
Once B1 has Completed.
So once B1 has been entered, the info in cell A1 will be deleted.
View 4 Replies
View Related
Nov 8, 2013
Creating macros in excel. I am looking for a way to delete a row at the active cell. So far this code does the job for me:
Code:
Sub slet()
ActiveSheet.Unprotect
ActiveCell.EntireRow.Delete
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
End Sub
But I want to make it impossible to use this code on the first 4 rows.
View 3 Replies
View Related
Apr 5, 2002
I want to delete part of a cell in Excel. For example if a cell had the data "BlueGreen" how would I delete the "Blue" bit just to leave the "Green" bit behind? Surely there is an easier way then physically deleting the first part in each cell? I have about 4000 cells to work on!
View 9 Replies
View Related
Jan 17, 2010
I have a pretty good sized Database and all the rows that are indented are not needed. Anyone know a way to delete all the text within a cell that is indented?
View 9 Replies
View Related
Jan 31, 2007
What I am trying to do is go through a large form and remove everything except for a certain set of cells, I am using this code
For i = 10000 To 1 Step -1
Set rng = Range("A" & i)
If rng.Value <> "Employee" Or rng.value <> " Total" Then
rng.EntireRow.Delete
End If
Next i
What I want it to do is go through the sheet and delete anything that doesnt have Employee or Total in column A, but my problem is that they dont JUST say Employee or Total, its more like Employee: Team A or Employee Group 1. The Total part always says "Total of " and a number, but the number is always different. How do I make it not delete it if it has Employee or Total anywhere in the cell?
View 3 Replies
View Related
Feb 22, 2009
I have column of numbers used as item codes, they appear with a small green triangle in each cell. When I select all cells a little blue square pops up with drop down options to convert to number- after doing this the green triangles disappear but then numbers I had listed as eg '043340' appear as 4334. Is there way to make sure zero's are not deleted as some of my results from formulas end up being incorrect.
View 3 Replies
View Related
Aug 24, 2013
I work for a bank and we use an excel spreadsheet that has an in depth payment calculator used for creating monthly payment arrangements or calculating settlements on bank loans. I would like to add the following feature and I'm not quite sure exactly how to do it.
For example, imagine cell A1 will contain the full payoff of a loan. I want to be able to put a settlement offer in B1 and have C1 populate the percentage of the payoff that is. At the same time, I want to be able to delete the settlement offer in B1 and put a percentage in C1 and have it calculate that settlement offer in B1. The calculations/formulas to do these problems is simple, but what I need is to not lose the formulas in B1 and C1 if I were to go back and forth entering settlement offers vs settlement percentages.
View 2 Replies
View Related
Jul 15, 2014
I have a worksheet that I use to store several static lists which populate various combo boxes in my application. However, I'd also like to use this worksheet to store a single column of data which can shrink or grow dynamically.
I have no problem with finding the last cell and adding data to that cell, but I'm having trouble with how to go about deleting the value of a single cell.
So as an example, If I've populated Cells A1:A10, and I want to delete the value that's in A6, how do I go about moving cells A7:A10 up one to fill in any empty spaces?
View 8 Replies
View Related
Jun 11, 2013
I have a file with 1000+ rows. The values in column A have text that I want to keep and then extraneous text tacked on. The good thing is the extraneous text ALWAYS start with the same characters. How can I systematically delete the extraneous text values at the end?
View 7 Replies
View Related
Oct 28, 2008
I have searched around and cannot find exactly what im looking for. I have a table of data and want to delete it all by clicking a button. I only want it to delete the rows which have data in.
Example
A1 = Apple
A2 = Apple1
A3 = Apple2
A4 = Apple3
A5 = *Empty*
So it would delete A1-A4 and not delete A5.
View 14 Replies
View Related
Nov 14, 2008
I would like to delete rows in a worksheet based on a value of a cell within that row. The worksheet will not always have the same number of rows. I will be looking at the value of each cell in column "AD", which is a date, and if it is not equal to 00/00/0000 then I want to delete that row.
View 7 Replies
View Related
Feb 26, 2009
I wish to randomly select a cell, using an InputBox, and then delete the entire row that cell is in. Once the row has been deleted the InputBox opens again for the next random cell to be selected.
When finished selecting I wish to cancel out.
View 9 Replies
View Related
Nov 8, 2009
I need help on Excel 2007 Macro , the below coding searches for a string "recvtiming" in a cell as a wildcard and delete it entire row once it founds it in a single active sheet.
Question,
1. How do I manipulate it to search for the same string and upon finding
a) Delete its cell content and all the contents from its right hand of side till its last column which have a value from the same row on all 50 sheets in the workbook.
e.g
a b c d recv 0 1 2 3 4
It should return,
a b c d
View 6 Replies
View Related
Oct 2, 2011
How can i delete a range of cell in another worksheet 2? for example, i have a data in B1:F1 in sheet 2 and i want to put a button in sheet 1 which will delete the data in B1:F1 in sheet 2.
View 1 Replies
View Related