vba code doesn't work
You get an error when there are no blank cells in the usedrange of column 2.
Perhaps they just look blank but are not.
--
Regards,
Tom Ogilvy
"lschuh" wrote in message
...
I tried to run this code and can not get the line
set rngtosearch=wks.columns(2).specialcells(xlcelltype blanks)
to run. Keep getting an error.
"Jim Thomlinson" wrote:
This gets rid of the rows where column B is blank. You can change the
column
designation to whatever column you want. It is more efficient than the
looping code...
Sub RemoveBlanks()
Dim rngToSearch As Range
Dim wks As Worksheet
Set wks = ActiveSheet
'The 2 refers to column B. Change it to whatever...
Set rngToSearch = wks.Columns(2).SpecialCells(xlCellTypeBlanks)
If Not rngToSearch Is Nothing Then rngToSearch.EntireRow.Delete
End Sub
--
HTH...
Jim Thomlinson
"lschuh" wrote:
In going through my worksheet I have used a transferspreadsheet from
MSAccess. The data within the query that transfers has several 0 in
it so I
don't want to remove those. However, there are several rows of blank
data at
the end of the spreadsheet that are null records. Can I do some kind
of
modification of this code to look for rows with empty records?
"K Dales" wrote:
Do Until ActiveCell.Value = ""
Should have no space between the quotes
--
- K Dales
"lschuh" wrote:
I found an example of vba code in a book "Using Excel 2003". It
doesn't work
and locks the entire application up. The code is:
Sub removenull()
Application.ScreenUpdating = False
Do Until ActiveCell.Value = " "
If ActiveCell.Value = 0 Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub
It is supposed to remove 0 from rows and delete rows.
What is wrong with it?
|