# Delete Entire Row Depending On The Contents Of A Cell

Jan 20, 2009

I'm trying to write a procedure which will search the contents of Column B of my worksheet for the word "Total". Whenever the word "Total" is found in a cell within Column B, the entire row should be deleted.

## Returning One Of 2 Formulas Depending On Contents Of A Cell?

Jan 27, 2014

I have a cell in which I am entering either the letter "C" or "S".

I then want the following to happen......

If the cell contains the letter "S" do = IFERROR(VLOOKUP(\$B7,'Asset Growth Rate'!\$A\$2:\$F\$39,2,FALSE)*\$C7,"-")

If the cell contains the letter "C" do = IFERROR(VLOOKUP(\$B28,'Asset Growth Rate'!\$A\$2:\$F\$39,3,FALSE)*(\$C28+\$F28),"-")

The formulas themselves are already working in separate cells, I now just want to combine them depending on whether the cell contains S or C.....

## Blank Out Certain Cells Depending On Cell Contents?

Oct 21, 2013

I have a spreadsheet that can do more than one calculation on each row

ITEM
FLOW
(l/s)

[Code]....

The values in row A can only be selected from a named range drop down. If no entry is there (i.e. blank) then i'd ideally like the cells to return from black to white.

## Selecting Entire Rows Based On Contents Of Cell?

Jul 15, 2013

I have a large set of data regarding the activities going on in particular rooms. The data contains activity name, start time, day, duration, room and size.

I would like to select all rows that contain a cell in the activity name column which contain the words 'VideoConference'.

I have tried to Search, Select All then index the remaining data using =iferror(index(etc. However some activities occur in more than one room and all variables apart from 'Room' are the same. Thus when I have tried to index the room column I get the same room for both rows.

ps the raw data set consists of +28000 rows so I can not simply look through and copy.

## Combine Contents Of Two Cells Depending On Contents Of Another?

Jan 14, 2013

I am trying to combine the contents of two cells depending on the contents of another, I have tried to use the If function but am coming up stuck!

I have provided a link to the example file below:

[URL]

## How To Delete ENTIRE Row If Only One Cell Is Duplicated

Jun 15, 2011

I have a file with 238 rows and 10 columns (see file attached) Column G include phone numbers, some phone numbers are duplicated.

How can I use a macro (I must do it with a macro) to delete the ENTIRE row if the value in column G is the same in other row?

For example: look at rows 2 and 3 : the value in column G2 and G3 is the same, therefor delete row 3

(and if the value in G4 was also the same, then delete also row 4, and so on..)

## Delete Entire Row If Cell Contains 3 Characters

Sep 5, 2013

I can't get this code to work which I want to delete the entire row if the cell in the specified range contains only 3 characters;

Code:

Sub CharCount()
Dim cell As Range
Dim bottomK As Integer
bottomK = Range("D" & Rows.Count).End(xlUp).Row
Dim rng As Range
Set rng = Range("D2:D" & bottomK)
For Each cell In rng
If Len(cell) = 3 Then
EntireRow(bottomK).Delete
End If
Next cell
End Sub

## How To Delete Entire Row That Has Blank Cell

May 14, 2014

VBA codes in filtering blanks.

Here is a screenshot, and what i want to do is to delete the entire row that has a blank cell. In which here, the 5th row, 7th row and 9th row.

## If Cell Contains The Word Delete Entire Row

Dec 10, 2008

Looking to write a macro to delete an entire row if the word GROWTH is found in any cell under Column C.

## Delete Entire Row If Cell Equals

Oct 1, 2007

I have a row range 5:20004. In that row range column R may have 'QLD' in the cell.

I am trying to delete all rows within that range that have QLD in column R or delete the row if R <> 'NSW' (would be a better way just in case there is something other than QLD)

to do this on opening the file automatically.

## Delete Entire Row If Cell Contains String

Jan 30, 2008

I need to write a macro that will search column A and find the word hospital or HOSPITAL and if found delete the entire row. The code I have below will do this ONLY if hospital or HOSPITAL is the only word in the cell. However in my column A there are numerous words in each cell i.e Saint Mary's Hospital.

Sub KillRows()
Dim rngNew As Range
Dim rngDelete As Range
Dim aCell As Range
Dim lastrow As Long
Set rngDelete = Nothing
Set rngNew = Worksheets("Sheet1").Range("A1", Range("A65536").End(xlUp))
rngNew.Select
For Each aCell In Selection
Select Case aCell.Value...........

## Delete Entire Row If Cell Greater Than Or Equal To 1?

Jul 12, 2012

i have table of values if any value in the coulomb G and I greater than or equal to 1 the entire row must be deleted how can i do this ?

## Delete Entire Row From Excel Table When Cell Not Zero?

Dec 27, 2012

How to delete the entire row if the cell value of the "D" column is greater then zero (not containing "0").

## VBA Coding - If Cell Value Equals To 0 Then Delete Entire Row

Mar 19, 2014

Basically, I have a table of data and I want to make a VBA coding so that Any row with "cell value = 0 in column C" will be deleted.

But I can't get my code working and i don't know why. There's no error pop up either.

## Cut / Paste And Delete Entire Row Based On Cell Value

Dec 13, 2013

I have got a vacancy tracker spreadsheet and I need it to move an entire row from the 'Open' to the 'Closed' sheet based on the status in column K, i.e. 'Closed +', 'Closed -', and 'Closed + Achieve'. Once this has been done I want it to delete the entire row in the 'Open' sheet. At the moment it just cuts the entire row and then it is left blank and when I delete it manually the macro stops working completely.

Also I can only get it to move 'Closed +' and 'Closed -' and seem not to be able to add a command to move 'Closed + Achieve' rows.

This is what I have got so far:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("K")) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Target.Value = "Closed +" Then

[Code] .......

## Delete Entire Row Based On A Cell Color

Mar 9, 2007

I used this macro to find the duplicates in column B:

Sub KryDups()
ScreenUpdating = False
FirstItem = ActiveCell.Value
SecondItem = ActiveCell. Offset(1, 0).Value
Offsetcount = 1
Do While ActiveCell <> ""
If FirstItem = SecondItem Then
ActiveCell.Offset(Offsetcount, 0).Interior.Color = RGB(255, 0, 0)
Offsetcount = Offsetcount + 1
SecondItem = ActiveCell.Offset(Offsetcount, 0).Value
Else
ActiveCell.Offset(Offsetcount, 0).Select
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1, 0).Value
Offsetcount = 1
End If
Loop
ScreenUpdating = True
End Sub

The duplucate cells are now red in color. (RGB(255, 0, 0)). How do I now code VB to delete the rows in column B where the cell color is red? Here is some of the code that I tried:................

## Delete Entire Row If Cell In Column Contains Certain Text

Mar 26, 2007

Delete entire Row if cell in column contains "Dog" in it.?

Example,

duck321
dog123
cat123
dog123
duck321
cat123

so after it would look like this

duck321
cat123
duck321
cat123

## DELETE CONTENTS If There Is Nothing In The Cell

Mar 14, 2008

What I need to do is starting at cell E251 of the Cheque Logging Sheet I need the code to check the cell for any contents and if there is nothing in the cell then DELETE THE CONTENTS then move to cell E250 and do the same all the way up to E2

My ACCESS problem is that even if the cells in Column E contain nothing the only way that I can upload the spreadsheet to Access is by deleting the contents of the empty cells. Currently I am doing this manually but I would rather sit back and have VBA do it for me...

## If Cell In Column Is Blank / Unpopulated Delete Entire Row?

Oct 16, 2013

If cells in column A3:A10000 are blank / unpopulated I would like to delete the blank rows.

## VBA Delete Entire Rows Based On The Value Of Single Cell

Jun 10, 2009

I know it can delete entire rows based on the value of single cell, I just don't know how to do it. So what I need is a macro that will delete an entire row if the value in a particular column = 0.

More details: ....

## Delete Entire Row If Cell In Column Starts With Asterisk

May 9, 2008

I'm using the following code to delete rows that I don't want to include and I've ran into some more things that need to be deleted...

For lLoop = RngCol.Rows.Count To 2 Step -1
Select Case RngCol(lLoop, 1)
Case " Date:", "Skill:", "Agent Name", "~*", "*Train*"
RngCol(lLoop, 1).EntireRow.Delete
End Select
Next lLoop

An example of "~*" would be: ***SICARII***
An example of "*Train*" would be: Ozgrid Train1

It's not recognizing these new cases. Do I have to utilize FIND? (since CTRL+F does work with the given cases)

## Formula To Delete Cell Contents After Use

Feb 28, 2007

I need a formula that would scan a given column for data, get the first available data from the first available cell ( D1 ), perform computation, input result in a different cell ( A1 ) and then delete the contents of D1 and move on the D2 and so on till end of data. So far I have been able to have the result in A1 but could not achieve the deletion of D1 contents. The purpose is to prevent the formula from scanning the data column from D1 again. In this way, the datawould be made available in one column and when the data have been processed the column would be empty and the result would be in another column.

## VBA Macro To Delete Entire Column When Background Cell Color Is Red

May 17, 2013

with performing the following tasks with VBA:

1). For each cell that in the range that has a Red background delete the entire column
I have attached a sample spreadsheet where I have tried to do this. It's not quite working. It does not seem to work when there are RED cells next to each other.

I know that I can do a simple thing like column("A:A"), but I'd rather have it in a loop as in the sample code, in case the columns change in the future.

2). The second task is to delete the rows in the spreadsheet where the first cell in the row is a blank.

## Macro Code To Delete Entire Row If Cell In Column Is Equal To Value

May 7, 2014

I need an easy code that searches all of column A and deletes the entire row if the cell has the value "-". It needs to find the last row of data using something like LastRow = Range("A" & Rows.Count).End(xlUp).Row

## Delete Contents Of Cell If Text Is Present?

Feb 13, 2014

Need to search a sheet and find cells that contain the text "Requirement". If found then i want that cell to become blank.

example
so in sheet1,

i have a number of columns and a number of rows

in cell A3 the value is - " there are requirements"
in cell F23, the value is -"the Requirement is"

since both cells have the word requirement, I want these cells to become blank.

## Delete Contents Of Cell If Text Is NOT Present

Feb 19, 2014

Need to search a sheet and find cells that contain the text "."

Want all cells that don't contain a "." (dot) to be erased from the sheet

Example : so in sheet1,

I have a number of columns and a number of rows

in cell A3 the value is - " there are requirements."
in cell F23, the value is -"the Requirement is."

since both cells have "." ( dot) , I want these cells to remain in the sheet, but the rest of the cells should become blank.

## Delete Cell Contents Based On Color

Feb 14, 2008

I am using conditional formatting to apply a light green color (index number 35).
Is there a macro that can delete the cell contents of the cells with this formatting in col K and L?

## Move Cell Contents & Delete Rows

May 23, 2006

I have a spreadsheet with a serial number is row 1 in column A with the rest of Row 1 empty. Column A is empty in Row 2, but has the data associated with the row above in columns B through L of Row 2. Then comes 2 blank rows and the pattern repeats with a new serial number in column A of row 5 and so on. I would like to move the serial number down one row, delete the now empty first row, delete the following 2 empty rows, and then loop to do the same thing again for all 9000 rows of the spreadsheet.

## Delete Rows Based On Cell Contents

Aug 29, 2007

I have merged two workbooks into one. What I need to do at this point is to delete all rows that have a duplicate entry, basically anytime the cell content in one cell matches the cell content in the cell right below or above it, BOTH rows should be deleted. At this point, this is above my VBA skills so I'm asking for help in how to do this. The stripped version of the workbook is attached (only 100 rows) but in reality this is a huge workbook with almost 22,000 rows.

You will notice in the attached workbook, that cell contents for A2 and A3 match. For what I need to do, I need both rows (2 and 3) to be deleted. If you go down a bit, starting in row 89 all the contents in column A are unique so those need to remain.

## Remove Entire Rows Depending On A Condition?

Oct 6, 2012

I have some data in column A I want to delete the entire row if the cell hasn't the character @