Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


How To Delete Alternate Rows

I have a huge excel file and every row is repeated, e.g.:

john smith 10 23
john smith 10 23
bob jones 11 22
bob jones 11 22

So I want to delete every second row.

Is there a command to do that?

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Sum Alternate Rows
I do an analysis that contains 100 or more rows with 1 of 2 row labels in column A; "existing" or "retrofit." There may be numerous successive rows labeled "existing" in a given place where there is no retrofit. Rows labeled "existing" contain existing equipment details such as area, equip description, operating cost. Rows labeled "retrofit" contain recommended efficient replacements with details such as area operating cost and savings. I have to display total cost and savings. Right now I use the awful method, F1+F3+F4+F5... for existing and F2+F6... for retrofit. This is a terrible method, time consuming, prone to error, etc. Is there a way to total rows with specific labels when the row labels are not consistently alternating? Would like to attach an example spreadsheet but... the permissions say I may not, for some strange reason.

View Replies!   View Related
Select Every Other Row :: Alternate Rows
Im trying to find a way select several rows at the same time but starting at say row 3 and then alternate rows so rows 3,5,7,9 etc

View Replies!   View Related
Fill Alternate Rows With A Color
is there any easy way to fill alternate rows of a worksheet with a particular color? I have a worksheet with 175 rows and alternate rows are to be filled with green!

View Replies!   View Related
Alternate The Background Color (fill Color) Of Rows In A Spreadsheet
how I can alternate the background color (fill color) of rows in a spreadsheet. Say I wanted every other row to be gray starting at row 10.

View Replies!   View Related
Delete & Merge Columns,Delete Rows With Filter, Etc
1. Remove J,K,N,A Columns,

2. In the last O (TIMESTAMP) column, the date is 14-Jul-09 format change it to 07/14/2009 (this format mm/dd/yyy

3.Filter L column (VAL_INLAKH) Remove all rows from whole sheet which has 0 value

4. Column C (EXPIRY_DT) date format is 24-Sep-09 , "dd-Sep-09" change to "Sep" only

respectively )

View Replies!   View Related
Delete Blank Rows & Rows Below Meeting Condition
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 Replies!   View Related
Delete Blank Rows (formula Not Deleting All Rows)
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
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 Replies!   View Related
Delete Rows Matching Criteria & Move Rows
I have a worksheet in which I have sorted the data based in date and numbering (column I and E). I would like to create 2 macros for following actions:

1- all rows with the value "TOM" in column C will have to be deleted.

2- all rows with a value of 601 or 602 in column E, will have to be moved to the bottom of the sheet after the last row with data. The rows that have been moved will have to be sorted based in date (column I) and numbering (column E).

View Replies!   View Related
Consolidate Matching Rows And Delete Duplicate Rows
I am working with timesheet data (name, project code, task code, date, hours etc...) in one spreadsheet and rate card data (name, role, day rate etc...) in another. My task is to pull together some of the information in each of these two source spreadsheets and compile a report. This I have done no problem. However, where a person works on a particular project and task on the same day and records multiple entries (which could be negative) I need to consolidate the hours in all these matching rows and have just one row reflect the total hours worked and delete the other duplicate rows. So an example would be:

Project | Task | Name | Role | Date | Hours

123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | 2.5
123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | -2.5
123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | 3.5
123456 | 1.001 | Jo Brown | Developer | 20/02/2008 | 7.5
123456 | 1.001 | Jo Brown | Developer | 20/02/2008 | -7.5
123456 | 1.001 | Sam Smith | Architect | 20/02/2008 | 7.5

Should be processed and come out like this:.......................

View Replies!   View Related
Delete The Columns First Then Rows Will Not Delete
Is there a limit on the number of rows and columns that can be deleted in a macro on Excel 2003? I am trying to create a macro that, amoung other things, delets 1119 rows and 54 columns. If I delete the columns first, the rows will not delete. If I delete the columns first, the rows will not delete.

View Replies!   View Related
Delete Rows Based On Criteria & X Rows Below
This sheet has A:K columns and 1:3212 rows. There are 'page headers' that are in the text file that I want to delete (the text file was exported from an AS400 program). The first row that starts the page header has SA341 in column 1. Each page header has 5 rows. I used this code from one of the other threads on deleting rows, but I obviously do not understand the code as it deleted all rows that contained SA341.
Sub DeleteRows()
Column_To_Check = 1
Start_Row = 1
End_Row = ActiveSheet. Cells(Rows.Count, Column_To_Check).End(xlUp).Row
MsgBox End_Row
Search_String = "SA341"
For Row_Counter = End_Row To Start_Row Step -1
If ActiveSheet.Cells(Row_Counter, Column_To_Check).Value < SA341 > Search_String Then

End If
Next Row_Counter
End Sub

View Replies!   View Related
Delete Rows Based On Values In Rows Below
I am copying a price list from a worksheet. I currently have a script that deletes unwanted rows (products) but these products' header rows' are left. I also want to delete these text based headers. One solution might be a script that reads a columns cell value in the row(s) below and if values are missing the header row should be deleted.

View Replies!   View Related
Delete Rows: Macro Skips Rows
Need to solve my problem in the thread "Type Mismatch Error Message". Now a new problem has come up in the same code, so - according to the rules - I've started a new thread. (This one is most likely due to my poor knowledge of VBA syntax).

Sub Delete_invalid_rows()
Dim i%, j%
Dim Nr%, valid As Boolean, BYPdata As Boolean
Dim ar1 As Variant
Dim ar2 As Variant
Dim ar3 As Variant
Dim ar4 As Variant
Nr = 20
ar1 = Array(11, 14, 19, _
20, 22, 25, 26, 27, 28, 29, _
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, _ .................

View Replies!   View Related
Sum Alternate Cells
I need to sum the contents of every fourth cell in row A .... ie sum(A1 + E1 + I1 ... BY1)

Can I do this via the formula bar, or do I need to use a VBA routine?

View Replies!   View Related
Alternate Is Statement
i have attached a copy of an excel file and if you look at the end i am trying to write an IF statement that reads if J = "2-0" then column M = 12-(K) or 12--4 so answer is 16 and then column N = -column M or -16 and then if J = "2-1" then M = 6-(K) or 6--0 = 6 and then N = -M .....

so if J was "2-1" and (K) -4 then the answer given for column M would be 6--4=10 and column N = -10

View Replies!   View Related
Alternate Way Of Displaying Data
I have been using a lot of sumproducting lately with multiple conditions to extract data. Lately I have noticed that though it is a good way to extract data there is a lot of calculation time involved in it. The Excel workbooks that i make are in a database like format where there is 1 sheet usually a data dump which has data from one column to the 200th column and rows being filled with data points till the 10000th row. Data headers in the columns are usually like Date(ColumnA), Tenure(ColumnB), Person, Type, etc and then from Column Z onwards there are columns which contain Data in the form of numbers like Number of cases, Number of this and number of that.

Now usually when creating a dashboard of this data for performance management I use the sumpoduct formula to retrieve data. It normally has conditions in it like for some given date ranges, Tenure ranges, People ranges extract x data for me. For Example something like this


View Replies!   View Related
Reference To Alternate Tables
I want to reference to a range of tables depending on the value of a separate cell. Problem is that I don't know how to insert this into the range part of the lookup formula.


=vlookup(a12,NAMED RANGE AS PER CELL c9,2,false)

Cell a12 is the lookup reference which is fine.

Named range is set-up and working fine.

Cell c9 is the description of the named range - season_indices_Asda_Cream

I want that to be changeable by he user so they can change the name in cell c9 from a drop down list so that the lookup formula redirects to the alternate named range...

View Replies!   View Related
Countif In Alternate Cells
I have a table of data that is laid out in multiples of two columns. I have attached a simplified example. Essentially all I need to do is count the contents of every second cell when it equals a specific value. If you look at my attached example it will be clearer. how I can do this using formula? (I don't want to use VBA in this instance).

View Replies!   View Related
Formula To Add Alternate Cells
I can't remember any formula to do the task. I have a time series with quarterly sales. The dates are in format given below.

01/01/1990 - first quarter of 1990
02/01/1990 - second quarter of 1990
03/01/1990 - Third quarter of 1990
04/01/1990 - fourth quarter of 1990

I need to add the sales of all first quarters , all second quarters..and so on.
Is there any formula that an elegant way or I have to do it manually?

View Replies!   View Related
Alternate Formula For Sum Indirect
I have tried to apply '= SUM(INDIRECT("A2:A10"))' formula to do the SUM at cell A11. But, if I add two more Rows, then my formula moves down to cell A13 but numbers in Cell A11 and A12 does not get added to the total. How can I avoid that? I have reserached this site extensively and could not find an archived solution.

View Replies!   View Related
Delete Rows Same As Rows On Another Worksheet
I have a workbook where I import data from another workbook. This might get done several times a month. As I go through the imported data I delete rows not needed which gets place into another worksheet. What I need is when I import data again is a macro that the worksheet where my already deleted rows are and compairs them to the new data imported and if the first 13 columns of data matches it delest them off the imported sheet.

I found some code which I altered at [url]

and posted the same question but haven't got any response as of yet.

So the code that i go works but only if the row matches in the exact order on both sheets so e.g. (if row 1 on sheet1 matches row 1 on sheet2) it works but if (row1 on sheet1 matches row 3 on sheet2) it does not.

Here's the code I have so far.

Public Sub delOLD()
Dim i As Long
Dim iLastRow As Long
Dim ws As Worksheet, ws1 As Worksheet

Set ws = Sheets("Data") ' Imported Data
Set ws1 = Sheets("Old Records") ' Deleted Data

'ws1.Visible = xlSheetVisible

View Replies!   View Related
Delete Entire Rows If Rows Below Has Value
I have a sheet as shown in the picture below. If the cells in Column N has some values that are the result of some calculations. How ever if there are more than one of it, the entire row has to be deleted.

Eg:The value in Column N 816.323 has 3 rows below each other.Only one has to be there.There can be upto 10 values one after other in this way.

I tried to write a progrma by using loops and cehcking if ther is value in the cell,go to cell below and if there is value,delete the row in a loop of 10 times.But it didnt work

View Replies!   View Related
Limitation Of 7 Nested IF Statements - Alternate
I have a workbook with two worksheets, Sheet1 and Sheet2. Sheet2 contains a table of values that need to be input into a cell on Sheet1, pending the results of comparing two other cells on Sheet1. I have 8 possible variations resulting from that comparison and I cannot make this work as the IF statement limits you to 7 deep.


A1 (text string value) = LOWER
B1 (text string value) = L1
C1 (currency with no decimals) = Sheet2!Somecell (decision of which cell to use depends on combination of A1 and B1)

A1 can be either the string "LOWER" or "MIDDLE". B1 can be the strings "L1", "L2", "L3", or "L4". The strings in B1 are not cell references, but simple text. This leads to four variations for a row that has "LOWER" in it's A column, and the same for "MIDDLE" - totaling 8 possible combinations.

Depending on the combination, I need to input a number from Sheet2 and that number is different for each unique combination of the eight possibilities. There is no mathematical calculation taking place on Sheet2 - just an "if x and y then z" decision on Sheet1. I will use the value of Sheet1!C1 in other math functions on Sheet1.

View Replies!   View Related
Macro To Populate Alternate Cells In A Row With A Value...
I have a spreadsheet for work rosters. Each person on the roster has a row with info on what they're doing for a given week. Split into the am and pm session of each day.

All I want to do is be able to fill the row with the same value if they're doing the same thing for the week - eg if they're on leave, I'd like to hit CTRL-L and have the row populated with 'LEAVE' in each alternate cell, rather than typing it manually. Note that it is each alternate cell, not each cell as the alternate cell has different info.

So a row would look like this:

Leave | blank |Leave | blank |Leave | blank |Leave | blank |Leave | blank |Leave | blank |Leave | blank |Leave | blank |Leave | blank |Leave | blank |

For the am and pm session of the five working days. And just to complicate matters, each 'cell' on my spreadsheet is actually 4 merged cells, and the alternate 'cell' that I want left alone is two merged cells! This is the macro generated when I do a simple record - it does what I want, but obviously jumps to the original row that I recorded it in whenever I run it - I need it to fill the row that I start it from. I recorded starting in cell I133:L134

View Replies!   View Related
Copy & Paste In Alternate Columns
I'm trying to copy and paste range in alternate columns from one worksheet to another. I can record this macro, but I believe it'll be really long because I have 21 alternate columns to copy and paste. What I'm trying to do:

-copy range B9:B41 in workbook 'Channel OU template' then paste values only in range BI9:BI41 in workbook 'final'
-copy range D9:D41 to range BK9:BK41
-F9:F41 to BM9:BM41
..and so on until the last column AP9:AP41 to CW9:CW41

Basically it's just simple copying and pasting from alternate columns. This is the really basic code that I have just for one column:

Sub copy()
Windows("Channel OU template").Activate
Range("bi9").PasteSpecial xlPasteValues
End Sub

View Replies!   View Related
Alternate Button Macro & Caption Between 2
I have a worksheet with 2 buttons labelled "Hide" and "Show". As the names imply, they allow the user to hide or show parts of the worksheet. I would like to combine them into one button and have the button label and the associated macro change with each press of the button. Here is what I have so far;

Selection.EntireRow.Hidden = False
ActiveSheet.Shapes("Button 20").Select
Selection.Characters.Text = "HIDE LEADS"
Range("A1").Select 'is there a better way to remove the focus from the button than selecting a cell off the button?
End Sub

Selection.EntireRow.Hidden = True
ActiveSheet.Shapes("Button 20").Select
Selection.Characters.Text = "SHOW LEADS"
End Sub

These macros change the label fine after hiding or unhding the rows but I can't find the proper terms to use to change the macro associated with the button (if there is one?)

View Replies!   View Related
Fill Alternate Cells Macro, All Sheets
Would like a script that will go to each sheet in the workbook, and fill in light grey background, each alternate row that contains data, EXCLUDING the 1st row (header row).

View Replies!   View Related
Adjusting Code To Use Alternate Cell Ranges
Here's a nice easy one for anybody whose used excel for more thaan a week unlike me, I'm using the following code to access a popup calendar:

View Replies!   View Related
Colour Alternate Lines With Conditional Formatting
change the colours of alternate rows in order to make reading line by line easier. I know that I have used this before as a Conditional action ie:- if(mod...... etc

As always, the program I used it in has 'disappeared' so I can't check back with that.

View Replies!   View Related
Find & Copy Cells & Paste To Alternate Columns
I have a spreadsheet that I would like to loop through column "C" and if criteria is met copy and paste A:C on sheet1 to sheet2 over multiple columns alternately. What I mean by alternately is that I would past the first row in column A6 then the second in E6 then the third in A7 and so on until all items are copied. I purposely left a blank column between both columns of information. I've tried sorting/and advance filtering and couldn't get it to work.

loop through column "C" If I have the Letter "A" copy data to column "A" and "E" alternately back an forth until I no longer meet the criteria. I start putting data on the 6th row due to header information in rows 1-5.
... If column "C" is the letter "B" copy to column I,M,Q,U

Lastly I could always have less rows of information than I do columns. SO the last column could be empty. I always sort my data by column "C" so data will be sequential.

View Replies!   View Related
Finding Min Cell Values Excluding Zero In Alternate Columns
I have an array that is 1 row high by 16 columns wide.

Each cell may contain a positive value, or a zero.

I need a formula to find the "Minimum value that is greater than zero" in
columns 1,3,5,7,9,11,13 and 15.

=MIN(A1,C1,E1,G1,I1,K1,M1,O1) will always return the zero value while I
need the minimum value that is greater than zero.

If I use nested IF functions to exclude zeroes I run foul of the max of 7

View Replies!   View Related
Search Column Then Update Alternate Sheet With Offset
Here's another question for you excel junkies to solve, while I try to understand what y'all are doing. I have two worksheets named "MASTER" and "BEDS". What I need to do, in sheet "MASTER" is go down column ("K:K"). "K:K" has unique data in it. then for each row...

"X" .value = offset minus one
"Y".value = no offset

now I need to go to sheet "BEDS" and find "Y" in column "A:A" then

from "Y" offset + 3.value = "TRUE"
"Y" offset +4.value = "X"

there should only be one instance of "Y" in column "A:A"..............

View Replies!   View Related
Sum Alternate Columns Base On Previous Column Entry
I am trying to resolve a calculation issue where I want to sum accross columns depending on an entry in the column immediately preceeding. The layout is an Attendance sheet, The columns are for the days of the Month ( 1 - 31 ) and the rows are the Months. There are 2 columns associated with Each day. The first column is for the type of Time Off ( Vacation, Sick, Personal, etc ) the column next to it records the number of Hours some one took off. The work book has a Sheet for Each Employee and a running total needs to be maintained for the amount of "off time" each employee takes by the various time off categories. I have tried setting up range names but this won't work as there will be multiple sheets. I believe the problem is the mixture of Text and Numeric data but could not resolve.

View Replies!   View Related
Conditional Format: Alternate Row Shading Based On First To Letters In The A Column
I have a price list from a friend. The price list has to have every other row shaded. This part is no problem with the conditional format command.

The real trick, at least to me, is the background shade of the row is based on the first two letters in the left most column.

For instance:

Column A


CP rows would alternate with one color while FL rows would alternate with a different color and FI rows would alternate with another different color. All other rows would have no shading.

MacOffice Excel 08 is used so no VB code can be used.

View Replies!   View Related
Change Colorindex Within A Range Of Multiple Cells [ Alternate Method]
I have tried to go around the long way to achieve this but came up with pages of pointless code .... I know there is a better way I just dont know enough about VB to do it myself ... And I know this is EASY for many :-)

Cell ranges h11 to as11 are a totals row.
If the total is 0, colorindex is set to vbpatternnone, if >= 1, then colorindex is set to vbpatterngray. Easy right ? I just dont kn ow how to do FROM/IF/DO range loops...

The code in worksheet_SelectionChange will contain the following:

1: From range h11 to as11, variable1 = application.interior.colorindex of the cell.

2: Check if the cell is >=1 or <=0 ....

3: If >=1 then set application.interior.colorindex = vbpatterngray. Go to #5.
' (This inserts a pattern over the original color of the cell)

4: If <=0 then set application.interior.colorindex = vbpatternNONE
ALSO set application.interior.colorindex = variable1
' (This clears the cell pattern and returns it to original color)

5. Repeat steps to clear cell pattern and restore color / or insert pattern for all cells from range H11:AS11

6. End sub

View Replies!   View Related
Delete #VALUE! Rows
can i have the macro if column B found "#VALUE!" delete entire rows


in this example row 3 will be deleted

View Replies!   View Related
Vba Delete Rows Above First Used
I'd like to find the first used row in a worksheet, and delete all the rows above it.. ie all the empty rows..

To show i am trying, yes i know very trying, i've got this far to find and select first used cell ( code from here) but can't work out how to select the area above..

i've been looking at from r = 1 to FR.Delete, thinking this would do it.. but sadly

Sub FirstRow()
Dim Rng As Range, rcell As Range
Set Rng = Range("A1", Range("A" & Rows.Count).End(xlUp))
For Each rcell In Rng.Cells
If Not IsEmpty(rcell.Value) Then
FR = rcell.Select
Exit For
End If
Next rcell
End Sub

View Replies!   View Related
Delete All Rows Except For Row 1
I wanted to select some criteria based on an AUTOFILTER and then have a macro delete all rows from 2 to the bottom... then SHOWALLDATA pick another set using AUTOFILTER and then having excel repeat and delete everything 2 down... the problem i'm finding of course is that when you AUTOFILTER row number 2 is not always at the top, so I need some relative I think..

sample .....

View Replies!   View Related
Delete Rows With #N/A
developing a macro that will test a cell. If the cell displays "#N/A" then I want the row deleted. Then move on to the next cell.

View Replies!   View Related
Delete Rows If NOT Contains
I want to delete rows if any given cell in A column do not equal values A B M or O

This sounds so simple, can someone remind me how to do this---I don't think I even need to use objects...

Sub DeleteExcept()

Dim LastRow As Long, r As Long

Dim objNAME As Ojbect

LastRow = Range("A" & Rows.Count).End(xlUp).Row

For r = LastRow To 2 Step -1
If Not objNAME.Value = "C" Or _
objNAME.Value = "B" Or _
objNAME.Value = "M" Or _
objNAME.Value = "O" Then
objNAME.Cells.EntireRow.Delete Shift:=xlUp

End If

View Replies!   View Related
Delete The Rows
Sub Delete_Schedule()
Selection.Delete Shift:=xlUp
End Sub

I really want it, so that it will delete what is in row 6, right down to the 2nd last one with something in it (because i have a border ending on the last one.

View Replies!   View Related
Delete A Set Of Rows
I am making a resource database at work. we do not have access, we have excel 2003. I need to pull name, address, phone # from a variety of sources and organize it so we can print letters, lists, labels etc. Often the data for on contact takes up multiple rows when you do a large paste. I figured out how to get it all in one row(I use =trim(cell) to place the cell where i want then copy the fuction to all rows I need for each column. then I copy and paste special =values to remove the cell reference) but this was leaves rows with garbage data.

(if ir takes up 2 rows it will be every other row that needs trashing, 3 rows the first row is good but the next two are trash, etc)

Is there a way to get excel to automatically remove the junk rows(ie if i select the section Im working on can I get excel to remove every second row?) or is there a better way of doing it so the junk rows dont happen?

View Replies!   View Related
Delete Rows With A Value Less Than 5
I have a spreadsheet that is generated for me and it is not always going to have the same number of records in it.

I would like to have a macro that searches column C and deletes any rows that have a value less than 5

View Replies!   View Related
VBA To Delete Rows
Need a code that will delete every row down from my last row used. Say my last value is in row 1000 (this will change everytime) and I need to delete from row 1001 to 65536 (whatever the last row in excel is). I have tired alot of things but can't get it to work.

View Replies!   View Related
Delete Rows With #value
I have a large sample of data,
approx 2000 rows across about 25 colums.

In a number of cells there are #VALUE! or #DIV/0!

Is there a quick way to delete any row that has one of these entries
in any of the 25 columns.

Data must also stay in current order.

View Replies!   View Related
Delete All Rows With #REF
How can I have VBA delete all rows with a #REF! error?

I was trying to use this code but it doesn't work (which i think is obvious why) but I don't know what variable to enter instead?

View Replies!   View Related
Delete All Rows Except These
The MS documentation was a mouthfull to i might add

I need to delete all the rows EXCEPT those containing a list of 10-15 names in column D.
The function should not be case sensitive, as some of the names are
in capital letters, and some are not.

really cool would be if there's a messagebox telling "No names found",
as all the rows then would be deleted.

View Replies!   View Related
Delete Rows :: Every 3rd, 4th And 5th Row
I have a spreadsheet with 10,000 rows

I want to delete every 3rd 4th & 5th row

View Replies!   View Related
Delete Rows And More
I have a large design table that I would like to copy the values, open in a new workbook, and then delete any rows with the value of "DELETE" in any column. This is a process that will be repeated many times. The columns with the "DELETES" will be different everytime. There may or may not be mulitple columns with "DELETE"s. The macro needs to be contained in only the original workbook but the actions taken while making the new workbook. Please let me know if this is even possible.

View Replies!   View Related
Delete Three Rows
The following code tried to delete the rows. If in column F, there are two consecutive cells are empty; And for one cell in column G, relative to cell in column F, if the cell is not empty, Then delete the three rows: r, r-1 and r-2. But the code does not work.

For r = DataLastRow To 8 Step -1
If IsEmpty(Range("F" & r)) And IsEmpty(Range("F" & r - 1)) _
And Not IsEmpty(Range("G" & r )) _
Then Rows("F"&datalastrow-2&":G"&datalastrow).Delete
Next r

View Replies!   View Related
Copyright 2005-08, All rights reserved