LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default specialcells(xlcelltypeblanks)

Hi,

I have a sheet that I have imported data to, it contains approx 35000 rows
and 7 columns.
10000 of these rows either have a empty cell in column A or has text in it
and I want to delete the entire row
Is there a quicker way then checking each cell in column A and then
deleteing that row.

Sub CheckForNumber()
Dim Lastrow As Long
Dim i As Long
Lastrow = Cells(65536, 1).End(xlUp).Row + 1
For i = Lastrow To 1 Step -1
Range("a" & i).Activate
If Not IsNumeric(ActiveCell.Value) Or IsEmpty(ActiveCell) Then
ActiveCell.EntireRow.Delete
End If
Next
End Sub

I have tried using the following to delete the empty cells

'On Error Resume Next
Columns("A:A").SpecialCells(xlCellTypeBlanks).Enti reRow.Delete
'On Error GoTo 0

but it deletes everything. I have used this in another workbook and it works
OK.

I have also tried filtering the data and only showing the blanks in column A
and then deleting visible rows, but I get an error message that it is too
complex to do.

Thanks in advance
Neil


 
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
Work around to SpecialCells(xlCellTypeBlanks)... DanF Excel Discussion (Misc queries) 7 June 29th 08 07:36 AM
Specialcells Bruno Uato Charts and Charting in Excel 0 October 7th 05 07:42 PM
VBA ON ERROR does not work with SPECIALCELLS Felix Excel Discussion (Misc queries) 2 April 14th 05 10:43 PM
.SpecialCells(xlLastCell).Select jim c. Excel Programming 3 October 3rd 03 04:02 PM
specialcells and toolbox button click event Srinath Excel Programming 2 August 13th 03 06:43 PM


All times are GMT +1. The time now is 01:13 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"