Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35
Default delete empty rows in workbook

Hi...

Ive got a problem with clearing rows. I want tp clear all the data in a row
if a cel in clomn B is emptry. I want to do that for the entire workbook. The
workbook im working in has about hundred sheets. It will take me hours to
clear all the rows manually. So far i got this code:

Sub ClearRows()
Dim rng As Range
Dim rowcounter As Integer
Dim sheetcounter As Integer

sheetcounter = 0
Do Until sheetcounter = 100
Sheet(sheetcounter).Activate
On Error Resume Next
Set rng = Columns(2).SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng Is Nothing Then
rng.EntireRow.ClearContents
End If
sheetcounter = sheetcounter + 1
Loop
End Sub

Can anyone please tell me what im doing wrong?? (using 2003)

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default delete empty rows in workbook

Hi

If they are blank use this example
http://www.rondebruin.nl/specialcells.htm

If this not working post back


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



"TooN" wrote in message ...
Hi...

Ive got a problem with clearing rows. I want tp clear all the data in a row
if a cel in clomn B is emptry. I want to do that for the entire workbook. The
workbook im working in has about hundred sheets. It will take me hours to
clear all the rows manually. So far i got this code:

Sub ClearRows()
Dim rng As Range
Dim rowcounter As Integer
Dim sheetcounter As Integer

sheetcounter = 0
Do Until sheetcounter = 100
Sheet(sheetcounter).Activate
On Error Resume Next
Set rng = Columns(2).SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng Is Nothing Then
rng.EntireRow.ClearContents
End If
sheetcounter = sheetcounter + 1
Loop
End Sub

Can anyone please tell me what im doing wrong?? (using 2003)

Thanks



Reply
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
Excel shared workbook copies rows by itself greg Excel Worksheet Functions 0 May 27th 06 04:04 AM
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
delete extra columns and rows matt charlton Excel Discussion (Misc queries) 1 June 7th 05 08:46 PM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
How to delete blank rows John Mansfield Excel Discussion (Misc queries) 3 April 27th 05 11:48 PM


All times are GMT +1. The time now is 03:57 AM.

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"