Delete Rows Of Data If Cells Contain Same Value From Another Sheet

May 30, 2014

I have got a set of data in a workbook with Sheet 1 range A1 to K373 and a range of data in Sheet 2 ranging from A1 to A30. What I will like to do is to have a VBA code to loop through all the cells in Sheet 1 column C and check which are the cells which value matches those in Sheet 2. Those that matches in Sheet 1 will have the entire row deleted. I have come out with the following codes but it does not work.

[Code] ..........

View 3 Replies


ADVERTISEMENT

Delete Rows Of Data From Existing Sheet

Dec 26, 2011

I have an excel list of My Existing Customers and have recently purchased an excel list of all possible customers in my market that happens to have my existing customers listed in it as well. How can I remove my existing customers out of this purchased list so that I can import it into my Database as Prospects? I'm using Excel 2010. Deleting duplicates doesnt work for this. I want a function that looks at data in one spreadsheetA and if it finds it in the second spreadsheetB, it deletes the row out of SpreadsheetB.

View 9 Replies View Related

Formula: Delete Rows If Common Data With Another Sheet

Feb 18, 2007

I have 2 spreadsheets of names (~2500 and ~1800) and a bunch of corresponding data continuing down the row. both are structured this same way:

Example:
Row1: LAST, FIRST, data1, data2, data3, etc...

is there a formula which can "check" the larger sheet for duplicate names (a row with exactly the same FIRST and LAST), and then either:
1) delete these rows from the smaller sheet
2) clear the contents of those rows
3) or at least flag them in some way so I can quickly delete them

it would be quite a task to eyeball and remove these rows one-by-one, so i'm wondering if a formula could somehow do it (I don't really know anything about visual basic)

One other piece of information which might be important:
For these rows containing duplicate first & last names between the 2 sheets, the entire row is not a duplicate entry; only the names will match (columns A & B)... The other columns down the row will have different values between sheet1 & sheet2. Not sure if this changes anything....

View 4 Replies View Related

Export Data To Sheet And Then Delete Rows NOT Contain Today Date

Jan 25, 2013

I have found some excellent code that exports rows to individual sheets based on values in a column, and it works perfectly. I have found some code that deletes any rows that do not contain today's date:

VB:

Dim LR As Long, i As Long
Application.ScreenUpdating = False
LR = Range("O" & Rows.Count).End(xlUp).Row
For i = LR To 1 Step -1
If Range("N" & i).Value < Date Then Rows(i).Delete 'N is column "Treatment Date"
Next i
Application.ScreenUpdating = True

But I'm having trouble adding this to the code I'm already using (that is working):

VB:

Sub Copy_To_Worksheets_2()
'Note: This macro use the function LastRow and SheetExists
Dim My_Range As Range
Dim FieldNum As Long
Dim CalcMode As Long
Dim ViewMode As Long
Dim ws2 As Worksheet

[Code]...

I tried adding it after the code " ' delete columns (after exporting from Current Patients)" but I received the error "Compile error - Duplicate declaration in current scope" as it relates to Dim LR As Long.

I have attached my spreadsheet : Daily Treatment Summary.xlsm

View 1 Replies View Related

Sheet Of Data - Delete Rows That Do Not Meet Specific Criteria

Nov 29, 2011

I have a sheet of data. The data starts in row 4 and can be variable in length. I want to delete rows that do not meet a specific criteria, for example a location, Leeds, which is in column "i" of the table. I have written the below but it seems to delete data from row 1 rather than row 4 and repeat down each row

Code below

Sub deleterows()
Dim i As Integer
Dim intCounter As Integer
Dim strLocation() As String

p = Range(Cells(4, 6), Cells(4, 6).End(xlDown)).count

[Code] ..........

View 3 Replies View Related

Delete Every Cells That Has Data Except For First Two Rows

Mar 9, 2012

What is the fastest way to delete every cells that has data except for the first two rows?

I currently have this code but I find it a bit slow (and everything is replaced by column A to Z [which meets my need right now]).

Code:
Sub delete()
Application.ScreenUpdating = False
lastrow = Activesheet.Cells(Rows.Count, "A").End(xlUp).Row
Range("a3:z" & lastrow).delete
End Sub

There must be a better way.

View 5 Replies View Related

Delete Rows In Sheet A If Any Conditions Found In Sheet B

Jul 3, 2014

I am trying to write a macro where it will delete rows in Sheet A if any condition is found in the row which is based of conditions in Sheet B.

Sheet A :
Column A Column B Column C Column D
1234 ABC tyu 4588
asd qwe www 4455
zxc zdaa 1234 4441
ghj llll 1111 poo0

Sheet B (where i kept my conditions in Column A: )

Column A
1234
1111
(and many more....)

the end results will be the Row 1 and row 4 will be deleted. I have tried to google but most only contains deleting rows with a specific conditions.

View 10 Replies View Related

Delete Rows That Contains Zero And Copy Active Sheet To New Sheet

Oct 2, 2009

I want DELETE the rows that contains 0 (zero or -) in column F (SALDO BRUTO), when I click the Button (Clear). And How I can copy from this sheet to a new sheet in this workbook, but the names of new sheet automatic rename to next date or 2, and next when I click the Button "Copy to New Sheet".

View 2 Replies View Related

Delete Empty Rows In New Sheet

Jan 10, 2013

My project looks like this:

I have a report that starts in column "A" and ends in column "J", I created several formulas in each cell, say, starting with column "K" till column "AA" to retrieve multiple data.

Not all formulas get values, there are many blanks. Longitude of the report is variable.

Now, I copy the content of K:AA and paste values only into new sheet. And that works fine.

Problem starts when I want to delete all empty rows in this new sheet.

Seems like after I paste, cells which I see as empty are in fact not empty, but non of them contains neither values nor formulas.

I tried 8 different ways of deleting emty rows and nothing works. They only delete empty rows above the content that I paste.

View 9 Replies View Related

Delete All The Rows Below From A Sheet If A Criteria Is Met

May 4, 2009

I have some data from A1 to A65536, there are few blank rows in between. i want to delete all the rows below the word "test" in that range. that is the word "Test" appears in A37686 that row and all the below Rows till the last row should be deleted.

View 9 Replies View Related

Find Value On Sheet & Delete Rows Below

Aug 6, 2008

I am trying to select all the data in every row below where the first "flat" entry in the worksheet is but it will only go to the bottom of the data in the column where it finds flat. Some data in other columns extends beyond this so it is not working for me. It would work for me to select everything from where it finds flat to the very last row 65536 but I can't figure out how to do that with what I have. I am then deleting all this data.

Cells.Find(What:="flat", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.EntireRow.Select
range(Selection, Selection.End(xlDown)).Select
range(Selection, Selection.End(xlDown)).Select
range(Selection, Selection.End(xlDown)).Select

View 3 Replies View Related

Moving Data From Rows To Columns And Delete Repeated Rows

Apr 16, 2014

removing duplicate rows and move other data frm rows to columns.xlsx.

I am attaching a sample excel sheet showing what I need to do.In the first tab, I have a list that includes duplicate rows (first column only). I want to remove those duplicate rows but I don't want to lose the data in the following columns which can be unique or duplicates as well.

see the desired result tab in the sheet to get an idea of what I am looking for as the end result.

Keep in mind that the actual source file I am working with could have up to 50000 row, and the expected results could be around 2000 rows. So nothing can be done manually.

View 5 Replies View Related

Delete Blank Columns And Rows In A Different Sheet?

May 27, 2014

I have command button in Sheet 3 (from where I will be running the macro) and I need a macro which will delete all the blank columns and rows in the data containing in Sheet 1.

View 2 Replies View Related

Delete Rows So That Student Only Appears Once On Sheet

Feb 13, 2014

I use this code to create sheets for courses but the student appears more than once - see attached Sample (Before sheet).

How can the code be changed so that the student only appears once on the sheet? - see attached Sample (After sheet).

Sample.xlsx‎

View 2 Replies View Related

Delete Rows Based On Criteria On Another Sheet?

Nov 21, 2012

few macros/vba that delete rows based on criteria in a cell.

I'm after something a little different. I have a workbook with sheets called Raw Data1, Raw Data2,Raw Data3, Raw Data4 and Raw Data5 and Menu.

There is a column of data in each of the sheets which has a column header of 'Location', however the column where this is located will vary from sheet to sheet. For example in Raw Data1, this is column 'J' and on Raw Data2 it will be column 'M', ( I'm not at work and can't remember the specific column positions for all sheets re: 'Location').

Is it possible to have on the 'Menu' sheet, say in cell B5 a value of 'Locationa' and have rows be deleted in each of the Raw Data that do not match the value in B5?

View 4 Replies View Related

Copy Sheet Then Delete Duplicate Rows

Jun 20, 2007

I have a worksheet that is composed a header row, and columns of data (client call results).
Each client is identified by a unique ID number in column A, a seperate column F has the 'call number, from 1 to x'.

So a client can have a single or multiple rows of data. Each client group of rows is sequenced with call 1 as line 1, call 2 at line 2, etc. etc. as your proceed down the rows.

The entire worksheet is already sorted (with a header row) ascending by client id and call #

What I want to accomplish is this

1 - copy the existing worksheet (CallRecords) to a new worksheet (CallToday)

2 - in the new worksheet, scan down (or up) from first data row (2) to the last row {ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row} and delete duplicate rows of the Client ID retaining the row with the max call number for that client id.

3 - sort the new worksheet (CallToday) ascending by column (G) date, and column (H) time.

View 6 Replies View Related

Auto Delete Rows To The Top Of The Sheet After Find

Sep 12, 2008

1) Highlight column A, and do a search on the word "Item"
2) Once it finds the word item, move 2 rows above it, and delete all rows above the word "Item"

The word Item at times can be on any row, and its very random, but its always in column, A. I tried doing it with a regular macro, but it seems to remember the row that I used, rather than two rows above the word "Item".

View 9 Replies View Related

Copy Data And Sheet Name To New Sheet And Delete The Old Sheet?

Mar 30, 2014

Example, I have a sheet named DATA1, I want to add a new worksheet, copy a certain range from the DATA1 sheet to the new sheet and rename it the same name DATA1 and delete the old DATA1 sheet.

Also, the sheetname will be unknown, the macro must get the sheet name first.

View 2 Replies View Related

Excel Macro Delete Rows Where Date Criteria Is In Another Sheet

Feb 28, 2014

I am trying to adapt a macro which deletes all rows in Worksheet 1 where the date in column K differs from a date in Worksheet 2. The date in Worksheet 2 will change each day.

I think the macro below could be used, but don't understand how to replace the "Value = ":70:" with a reference to the master date in Worksheet 2.

Sub test() Dim lr As Long, i As Long lr = Range("A1").End(xlDown).Row
For i = lr To 1 Step -1 If Cells(lr, 1).Value = ":70:" Then
Cells(lr, 1).EntireRow.Delete End If lr = lr - 1 Next i End Sub

View 2 Replies View Related

Delete Rows With Cells That Have Same Value

Jul 18, 2014

I have a sheet with rows that extend to about Column AT. In some of the rows, all the cells are populated with "--". I want to delete these rows. Other rows have "--"s but not in every cell. I tried to remove all the "--"s then running this code:

For t = 2 To Workbooks(WorkbookNm).Sheets("--").UsedRange.Rows.Count j = CStr(t)
If Application.CountA(Workbooks(WorkbookNm).Sheets("--").Range("A" & j).EntireRow) = 0 Then
Rows(t & ":" & Workbooks(WorkbookNm).Sheets("--").UsedRange.Rows.Count).Delete
GoTo Step15__2:
End If

It worked, but I had trouble re-adding the "--"s. So I'm wondering if there is a simple way to modify the above code, so that it looks for and deletes rows with only "--" and possibly nothing in the cells (e.g. Column AU and on)?

View 9 Replies View Related

Delete Rows With Cells < #

Jun 29, 2009

I'm trying to create a macro and having absolutely no luck with it. I want the macro to run through all the rows and delete all rows where every number in that row is less than a specified number (.03 for this particular case).

View 19 Replies View Related

Delete Rows Where 2 Cells Are The Same

Apr 24, 2008

I m trying to develop an IF function that will go through each cell in a column and delete an entire row based on whether the Cell Value is identical to the one above or not. What i have thus far:

Sub RemoveDuplicate()
Dim i As Integer
Sheets("Pre-Allege").Activate
i = 2
Cells(i, FindCol + 2).Select
Do Until IsEmpty(Cells(i, FindCol + 2))
If Cells(i, FindCol + 2) = Cells(i - 1, FindCol + 2) Then Rows("i:i").Delete Shift:=xlUp
Else
i = i + 1
End If
Loop
End Sub

View 4 Replies View Related

Delete Rows With Cells That Contain Some Word?

Mar 4, 2014

How can I delete all rows that have a cell that starts with the letters APP

View 3 Replies View Related

Delete Rows Where Cells Don't Contain Specific Value

Feb 27, 2013

If I have a column of data called "ColStream" and want to delete all rows that don't contain the string "Production", whats the best way to achieve it?

I have tried a for each loop, with INSTR but as this moves down a cell from the cell whose row has just been deleted, skipping the "NEXT" row in the range, it doesn't give the correct results.

Incidentally, the end game is to copy all the remaining cells to the cell immediately below a cell called "StreamsDatabaseStart" in a worksheet called "ProdStreams" should anyone out there be feeling particularly charitable!

View 4 Replies View Related

Delete Rows Where 2 Cells In Same Row Is Blank

Oct 18, 2006

I want to compare the data in column B and C of Row 2 through X (X being up to 20,000), and if BOTH B and C are blank, delete the entire row.

View 4 Replies View Related

Delete Rows With Blank Cells

Jan 8, 2007

I need a Macro that will delete rows within a specific range that contain blank cells or preferably delete the rows where the first cell in the row contains a blank cell.

View 9 Replies View Related

Delete Rows With Some Blank Cells

Jan 17, 2007

I went to the Macros page and pulled this macro to remove rows if they have blank cells:

Sub DeleteBlankRows2()
'Deletes the entire row within the selection if _
some of the cells WITHIN THE SELECTION contain no data.
On Error Resume Next
Selection.EntireRow.SpecialCells(xlBlanks).EntireRow.Delete
On Error Goto 0
End Sub

I ran this and nothing happened. Does anyone have a fix or perhaps a better way to make this happen?

View 2 Replies View Related

Concatenate Cells And Delete Rows With A Twist

Jun 5, 2009

I have a spreadsheet with three columns (check #, invoice #, vendor #). If a check pays multiple invoices, there is a separate row for each instance of invoice #. (ie if a check pays 10 invoices, there are 10 rows all with the same value for check # and vendor #, but different invoice #s). I need to concatenate the multiple rows to just one row per check #, with all the invoice #s in separate columns on the same row and delete the duplicate check # rows.

However, I can only use 10 columns, so if there are more than 8 invoices matching the same check #, the 10th column will need to contain invoices 9-n concatenated and separated by a space. I have over 5000 rows in the spreadsheet.

View 2 Replies View Related

Delete Unwanted Rows Based On Value In Cells?

Sep 28, 2011

I am aware this is probably very simple, but I haven't been able to find a usable macro yet. I would like the data in the workbook that is not "Tuesday" (column L) and is not "3" or "4" (column I) to be deleted. All rows that have "Tuesday" and either "3" or "4" should not be deleted. Each row that is not deleted must have Tuesday in column L. All other cells are blank intentionally. The workbook will remain the same titled WKBK1 (no need to put the output data in a separate workbook nor separate spreadsheet).

Do you know what the macro would be so I don't have to copy and paste a formula over a large number of cells?

WKBK1
A B C D E F G H I J K L 2
3

[Code]....

View 8 Replies View Related

Simple Delete Rows Based On Cells Value

Apr 3, 2013

I am simply trying to delete all rows that have a value of less than 16 in the cell value's first 2 characters (column G).

Start with:
18N
18K
16K
16K
16K
14L
14L
13L
12L

End with:
18N
18K
16K
16K
16K

The code I am using:

Sub DeleteUnneededRows()
Dim c
For Each c In Worksheets("Sheet1").Range("G1:G500").Cells
If Left(c.Value, 2) < "16" Then
c.EntireRow.Delete
End If
Next
End Sub

but it is not working.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved