Delete Rows Based On Adjacent Blank Cells

Aug 8, 2008

I would like a macro that deletes rows based on having two blank cells in adjacent columns. I have achieved this with the following code however i need it to only delete rows below a certain row. How would i achieve this?

Sub DeleteBlankARows()
Dim r As Long
For r = Cells(Rows.Count, 30).End(xlUp).Row To 1 Step -1
If Cells(r, 3) = "" And Cells(r, 4) = "" Then Rows(r).Delete
Next r
End Sub

View 2 Replies


ADVERTISEMENT

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

Macro To Delete Rows Where There Are Blank Cells

Sep 25, 2013

I would like code that will delete all rows where there are blank cells in Col D from row2 onwards.

View 2 Replies View Related

Delete Rows With Blank Cells In A Specific Range

Feb 23, 2010

I need a VBA to delete rows with blank cells within columns F - AZ
Columns A - E contain headers but also need to be deleted if cells in columns F -AZ are blank.

View 9 Replies View Related

Delete Rows With Blank Cells But Housing Formulas

Sep 1, 2009

I have several lists that I need to be able to print out periodically.

The main worksheet that underpins each list is over 900 lines long and numerous calcs and formulae populate columns to provide the data for my 'print lists'.

I need my 'print lists' on seperate worksheets and I have linked the data from my main worksheet results, using IF statements to stop unwanted results being displayed by making the rows appear empty (i.e. to display "").

Due to the design of my main Worksheet it is inevitable that I have many rows in each 'print list' that are not required for that particular 'print list'.

I want to remove the 'empty' rows from the print sheets at the time of printing. I cannot use the GoTo > Special > Blanks > Delete Rows because the rows are not recognised as being 'blank'.

I have attached 2 screenshots of my 'print lists'.

P.S. I am not assuming anything but I have searched on OZGRID and it appears to me that I might need to use Excel/VBA?

View 9 Replies View Related

Copy Non-adjacent Cells In A Row From One Spreadsheet To Adjacent Rows In Another

Jan 5, 2014

I have a workbook with 30 worksheets. Each sheet has 84 rows of data (start in 15 columns (A to O). I would like to create a summary sheet that only shows the most important data from each sheet.

The summary sheet would have 12 lines of headers and formatted crap at the top.
The Summary sheet header columns would be:

Site (A), Date (B) Health (C), Status (D), Critical (E), Task (F),
Dependencies (G), Owner (H), T-Date (I), Task Date (J), Mitigation Date (I)

The data in the sheets are not in that order, of course.

That
1. puts the name of the sheet I am copying from in column A
2. the deadline date in Column B (that date is always in C10 of each worksheet)
3. and copies Cells from Column A,B,G,H,I,O in any row in which the value in A is not "good" into columns C through H. I would like to paste those rows into the summary sheet. I have code that loops through the sheets and rows in each sheet to find the rows to copy. I can copy cell values directly from the active sheet to the summary sheet, but because I am copying a cell at a time, it takes 7 minutes. Yes I am impatient :)

Here is the code snippet where the copying is done:

Dim sh As Worksheet 'current worksheet
Dim DestSh As Worksheet 'worksheet in which to paste summary
Dim Last As Long
Dim CopyRow As Long 'row to copy
Dim LastCopyRow As Long

[Code] ........

ExitTheSub:

Application.Goto Sheets("KMARollup").Cells(1)
End Sub

I think there must be a way to use ranges to build an array of cell values and paste only once but I am lost here.

View 2 Replies View Related

Hide Rows Based On Blank Cells?

Feb 21, 2014

I am attempting to hide a series of rows based on if the cells in that row are blank. The catch is that the field of data in the column may vary as follows:

D E F G
x x X x
x X x
x

I would like to eliminate all the rows past the last X value in Column D for example

Below is the code I am attempting to use

Rows("41:60").Select
ActiveWindow.ScrollRow = 41
ActiveWindow.ScrollRow = 42

[Code].....

View 8 Replies View Related

Sum 3 Non-adjacent Cells Some Are Blank?

Mar 5, 2014

I am trying to sum 3 non-adjacent cells. Some cells are blank, not always in the same row / column, and all are the result of vlookups. I tried: E = I+M+Q, but the result is #value!

-In column E (respectively F, G, H) that's where I want the result of the sum

-In column I (respectively, J, K, L), depending on the row, some cells are blank and some cells contain a number. That's the first term of my sum.

-In column M (respectively N, O, P), I have also blank and non-blank cells, depending on the row. This is the second term of my sum.

-In column Q (respectively R, S, T), also blank or non-blank cells. This is the third term of my sum.

I will need to extend this formula to F=J+N+R, G=K+O+S, H=L+P+T, and probably also a sum with 4 terms where E=I+M+Q+U etc.

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

2003 - Merging Four Adjacent Cells With Text And/or Blank Cells

Jun 14, 2008

I am trying to merge text, in four adjacent cells in the same row (say cells A1,A2,A3 and A4), into a single cell (say cell A5).

I would like a comma or full stop and then a space between each item merged (cell A5).

The text to be merged may appear in any one of the four cells (cells A1 to A4). Those cells without text are blank.

Only where all 4 cells are blank, will I need cell 'A5' to indicate this.

The formula needs to be relative as I will need to copy the formula down the spreadsheet so that it applies to additional rows.

View 9 Replies View Related

Conditional Formatting Based On Adjacent Cell Not Being Blank

Mar 6, 2014

I want AB1 to highlight red if date in S1 is not blank and N1 doesnt equal AA1. Is this possible?

View 1 Replies View Related

Delete Rows If Adjacent Cell Value Is From A Defined List

Mar 25, 2013

If I have a list in sheet1, of say 300 names, I need some code, that for a table on sheet2, from A1 to F500 will delete the contents of cells in columns B C and D, IF the value for column A in that row is from the list in sheet1

List of names: sheet1, A1 to A300

Table that needs changing: sheet2, A1:F500

cells to be deleted in columns B C D IF value in A corresponds to the list in Sheet1

View 3 Replies View Related

Only Countif Cells Adjacent To Columns Contains A Blank?

Apr 22, 2014

I have a formula (below) where I want it to count the cells that contain a date that is less than or equal to today, but only when the adjacent cell is blank. The latter part of the formula works, but I'm struggling to tell it to only do the count when cells in column I are blank;

=IF('QS12'!I10:I3120="",COUNTIF('QS12'!H10:H3120,">="&TODAY()))

View 9 Replies View Related

Using Macros To Delete Cells And Rows Based On Specific Criteria?

May 7, 2012

Each week I run a report that produces over 2,000 rows. I have to manually go through and delete things, by the time I am done, there may only be 320 rows left. I would apply a recorded macro, but the report is not consistent each week. There may be more or fewer rows depending on the week.

I would like to be able to run a macro that looks in column B for a specific value and if it contains that specific value, I would like the cells to the right of it to have their contents cleared.

Next, in column C, I have...

Employee2's Name
Employee2's Number
SPACE

[Code]....

I would like to be able to delete the rows, starting from Employee 2 to just before the second SUB TOTAL.

So, all I would have left in column C is

SUB TOTAL
SPACE

View 9 Replies View Related

Macro Delete Row Based On Color And Adjacent Cell?

Mar 28, 2014

i am looking macro formula to delete row with 2 criteria :

- delete rows if yellow color background and based on adjacent cell (blank cell), otherwise keep rows when adjacent cell not blank

View 8 Replies View Related

Fill In Blank Cells If Adjacent Cell Has Value Then Do For Next Set Of Data

Feb 19, 2014

I'm trying every conceivable angle I can think of in vba and coming up empty. What I have is a spreadsheet similar to this:

Column A Column B

1. 1234567
2. 2345678
3. 3456789
4. 4567890 A0001
5.
6. 9876543
7. 9876543
8. 9876543
9. 1234578
10. 3456789 A0002

What I would like to do is to fill in B1:B3 with A0001 and B6:B9 with A0002. The number of rows in each set of data will vary, but the identifier (A000X) will always be located in the row in column B adjacent to the last entry for that set of data in column A and there will always be empty cells between data sets. The number of data sets will also vary.

View 5 Replies View Related

Stopping Data Entry If Adjacent 5 Cells Are Blank

Feb 10, 2009

I've got six columns with drop-down lists in every cell. I don't want column six to be selectable if the first five drop downs don't have data in them too.

Equally, I want the data in column six to be undone if columnns 1-5 are then unselected. Can I do this?

I know that using data validation or VBA is an option but I'm not sure exactly how to set it up this way. I also don't want anyone screwing with what can and can't be entered according to these rules - I want to keep it watertight!

View 9 Replies View Related

Excel 2010 :: Delete Duplicate Rows Based On Values Of Cells

Jun 17, 2014

I'm new to VBA and macros, using Excel 2010, and am trying to figure out how to delete all duplicate rows in a sheet where 2 or less of their values in column A is "1". I'd like have a script that is flexible enough to change to 3 or less if need be. I also have a header row that needs to be offset in the process.

A---B-
0--123 <-delete
0--123 <-delete
0--123 <-delete
1--123 <-delete based on this the value of column A
0--123 <-delete
0--123 <-delete
1--321
1--321
1--321
1--321
1--321

or

A---B-
0--123 <-delete
0--123 <-delete
1--123 <-delete
1--123 <-delete based on this the value of column A
0--123 <-delete
0--123 <-delete
1--321
1--321
1--321
1--321
1--321

View 5 Replies View Related

Calculating Sum Of Cells Only Where Adjacent Cells Are Blank

Oct 17, 2008

Code:.....

I am constantly editing this (we currently have over 100 accounts) and therefore the totals are changing.I have a formula for Total but I need formulas for the other two, based on when the cells in columns F and J are blank or have dates in them: For active, the total is the sum of all numbers in column M but only when there is a date in column F and a BLANK in column J. For yet to enter, the total is the sum of all the numbers in column M but only when both column F and column J are blank. At the moment, my accounts run from row 6 to row 142, with the first line of totals in row 145, however this is constantly expanding.

View 4 Replies View Related

Rule To Delete Data From Adjacent Cells

Feb 5, 2008

For the first grouping of data (Ex 1) I need to do the following; if the value in column J is less than 49 then delete the data in the corresponding row from column E to K. For the second grouping (Flx 1) if the value in column R is less than 49 then delete the data in the corresponding row from column M to S. I would like to be able to do this for all groups all the way to group Flx 5. All my sheets are set out in this way but I am not sure if I can do this using a formula or a macro (which I am not very experienced at writing).

View 3 Replies View Related

Delete Blank Rows (formula Not Deleting All Rows)

Sep 30, 2008

I have the following codes to delete all blank rows in column A

Dim lastrow As Long
lastrow = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
MsgBox lastrow

With Sheet1
For t = 1 To lastrow
If Cells(t, 1) = "" Then
Rows(t).Delete
End If
Next t
End With

End Sub

Although it is working , it is not deleting all the blank rows at once, I have to keep pressing on the macro button running the macro several times, until all blank rows are completely deleted.

View 9 Replies View Related

Delete Blank Rows & Rows Below Meeting Condition

Jun 21, 2008

I have an imported report in a spreadsheet. It imports to three columns. I need to check each row in column A for three seperate criteria and delete the rows I don't need. I need to delete blank rows and check next row for page header info. Delete these and next rows to next blank cell. Check next row for page header and not delete if not page header. Several rows down will be a cell with 23 blank spaces before the word Reg: and sometimes other words past this but always this first. This row is to be kept. I looked at the FAQ's example of Deleting but I don't think it will work. I also need to put a key word in column A at a point where I want to stop. This report is a couple thousand rows long so a VBA procedure would really save time. I have a procedure I use to check for two zero's in two cells that hide these rows but I couldn't modify it to work on this report.

View 9 Replies View Related

How To Delete About 86k Blank Rows

Jun 17, 2014

I have been trying to delete about 86k rows in my table in a worksheet. It has been over 5 hours now and it is still running to delete. any better solution? or how long do i need to wait for the system to finish its work?

View 1 Replies View Related

Only Delete Rows When Whole Row Is Blank

Jan 19, 2012

I have a real problem with a file I'm working on. It has invoice numbers in one column, followed by payment milestones. In the row underneath, there is an 'x' to mark if payment was made in a particular zone, e.g.:

6010136113221/06/201005/07/201022/07/201016/09/2010XXX6010136113313/07/201030/07/201013/08/201014/10/2010XXX

The problem is that there are two rows with data, a blank row, then another two rows with data. I have thousands of rows and need a quick-fix to delete the blanks.

View 1 Replies View Related

VBA To Delete Blank Rows

Feb 23, 2013

a VBA code to delete blank rows.

The current worksheet has data which is retrieved from other worksheets.

For example:

Current worksheet A1= Sheet1!A1
Current worksheet A10= Sheet2!A1
Current worksheet A20= Sheet13!A1

The range of this current worksheet is A1:F1287 and inbetween there are blank rows. The cells in the current worksheet are not technically blank, because each cell (A1:F1287) retrieves the information from the respective worksheet.

I would like to know of a VBA code to delete a whole blank row/-s (all columns of this row is blank) inbetween the range. Therefore, if there is a whole blank row, this row to be deleted and to go to the next row that shows information . In other words, instead of me manually searching and deleting whole empty rows; a VBA code for this task.

View 9 Replies View Related

Too Many Blank Rows To Delete

May 9, 2007

modified my code to have the data continue to the next row where it left off before jump to other sheets. The code below creates too many blank rows of all sheets (9213, 9316, 9501 and 9601).

After the code stops execute, I have to delete all the blank rows. This takes too long, approximately 5 minutes for each sheet...

View 9 Replies View Related

Delete Blank Rows ..

Apr 24, 2009

I am trying to write a macro that will check from 1 to 143 columns..and if all the columns are empty then it has to delete that entire line. Totals rows are over 35000. I am using excel 2007. I have written the below code. Could someone pl help me in enhancing this.. or a better way as this is taking about an hour to complete.

Sub Costa()
Dim i As Long
Dim j As Integer
j = 2
For i = 2 To 37735
loop1: For j = j To 143
If Cells(i, j) = "" Then
j = j + 1
GoTo loop1
Cells(i, j).EntireRow.Delete
Else
j = 2
GoTo loop3
End If
Next j
Cells(i, j).EntireRow.Delete
loop3: Next i
End Sub

View 9 Replies View Related







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