LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Removing blank lines in a workbook

I am trying to use code that was listed in a previous newsgroup posting to
remove blank lines on a worksheet. Is there a way to set this up as a macro
that would work for all worksheets in the workbook? I am not very
knowledgeable with VB language. Below is the posting I have followed so far.
It works for 1 worksheet, but not for the entire workbook.

Thanks for any help.

I have assumed that if the cell in column A is empty then this identifies a
blank row. If that is correct then right click the sheet tab, view code and
paste this in:-

Sub surface()
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

For x = LastRow To 1 Step -1
Cells(x, 1).Select
If Cells(x, 1).Value = "" Then
Selection.EntireRow.Delete
End If
Next
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete Blank lines in excel workbook? Hemant Excel Discussion (Misc queries) 2 September 20th 09 01:37 PM
How do I print lines in a blank workbook? Carla Missouri New Users to Excel 3 November 26th 08 10:29 PM
Removing zero value lines ccswfl Excel Worksheet Functions 0 June 21st 07 05:17 PM
Copying and pasting a worksheet to a blank and removing blank rows Bob Reynolds[_3_] Excel Programming 0 June 24th 04 02:55 PM
how to automatically insert blank lines in between non-blank lines No Name Excel Programming 2 November 17th 03 03:40 PM


All times are GMT +1. The time now is 01:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"