ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Deleting every-other row in a spread sheet (https://www.excelbanter.com/excel-discussion-misc-queries/1497-deleting-every-other-row-spread-sheet.html)

smintey

Deleting every-other row in a spread sheet
 
I have a spreadsheet in excell that contains info imported from word. As a
result every-other row is blank. I would like to erase these empty rows so if
anyone knows how to go about this it would be gratefully appreciated!!

Thanks in advance
Steve

John Mansfield

Smintey,

If you a familiar with VBA, you can delete the rows via code. For example,
this procedure deletes rows with empty cells in column A:

Sub DeleteRows()
Dim lLastRow As Long
Dim Rng As Range
Application.ScreenUpdating = False
Rows(1).Insert
Range("A1").Value = "Temp"
With ActiveSheet
.UsedRange
lLastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set Rng = Range("A1", Cells(lLastRow, "A"))
Rng.AutoFilter Field:=1, Criteria1:=" "
Rng.SpecialCells(xlCellTypeVisible).EntireRow.Dele te
.UsedRange
End With
End Sub

"smintey" wrote:

I have a spreadsheet in excell that contains info imported from word. As a
result every-other row is blank. I would like to erase these empty rows so if
anyone knows how to go about this it would be gratefully appreciated!!

Thanks in advance
Steve


Bob Umlas

If you sort them, the blanks will all go to the bottom.
If that option doesn't work for you, you can enter 0,1,0,1,0,1,0,... down an
unused column, where the 1's correspond to the blank rows, then sort by this
column, then delete the 1's at the bottom.

I'm leading a FREE 1-hour online Webinar on Excel Tips & Tricks.
Dec 16, Jan 14, Jan 27 from 4-5PM (each session is the same).
If interested, go to http://www.iil.com, click on the yellow/orange
"Try a free webinar" link on the left side, click the Microsoft Excel
Tips & Tricks link, follow instructions to register.


"smintey" wrote in message
...
I have a spreadsheet in excell that contains info imported from word. As a
result every-other row is blank. I would like to erase these empty rows so

if
anyone knows how to go about this it would be gratefully appreciated!!

Thanks in advance
Steve




Ken Macksey

Hi

Make a backup copy of your workbook first, then you could use something like

For i = 20 To 2 Step -2
Rows(i & ":" & i).Select
Selection.Delete Shift:=xlUp
Next i

Where 20 is the row number of the last blank row under the last data row and
2 is the first blank row under the first data row.

Be sure to get the numbers right so you don't delete any data.

HTH

Ken



Ron de Bruin

Hi smintey

You can also use Sort (DataSort)
Select your data first



--
Regards Ron de Bruin
http://www.rondebruin.nl


"smintey" wrote in message ...
I have a spreadsheet in excell that contains info imported from word. As a
result every-other row is blank. I would like to erase these empty rows so if
anyone knows how to go about this it would be gratefully appreciated!!

Thanks in advance
Steve




Gord Dibben

Steve

Select a column.

F5SpecialBlanks

EditDeleteEntire Row

Gord Dibben Excel MVP

On Wed, 8 Dec 2004 07:27:01 -0800, "smintey"
wrote:

I have a spreadsheet in excell that contains info imported from word. As a
result every-other row is blank. I would like to erase these empty rows so if
anyone knows how to go about this it would be gratefully appreciated!!

Thanks in advance
Steve




All times are GMT +1. The time now is 11:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com