Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default runtime 1004 error on deleting rows with blank cells

Hi
I get a runtime 1004 application or object defined error when I run this. I
want to delete the rows with blanks in column "M".

TIA
-------------code---------

Public Sub deleteRows()



Dim rngToDelete As Range

With ActiveSheet
On Error Resume Next
Set rngToDelete = .Range(.Range("M1"), .Cells(Rows.Count,
"M").End(xlUp)).SpecialCells(xlCellTypeBlanks)

On Error GoTo 0
End With

If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete


End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default runtime 1004 error on deleting rows with blank cells

Janis,

I gave you the code in your previous post,

Sub deleteit()
Set myRange = Range("M1", Range("M65536").End(xlUp))
myRange.SpecialCells(xlCellTypeBlanks).EntireRow.D elete
End Sub

Right click the sheet tab, view code and paste it in.

Mike


"Janis" wrote:

Hi
I get a runtime 1004 application or object defined error when I run this. I
want to delete the rows with blanks in column "M".

TIA
-------------code---------

Public Sub deleteRows()



Dim rngToDelete As Range

With ActiveSheet
On Error Resume Next
Set rngToDelete = .Range(.Range("M1"), .Cells(Rows.Count,
"M").End(xlUp)).SpecialCells(xlCellTypeBlanks)

On Error GoTo 0
End With

If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete


End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default runtime 1004 error on deleting rows with blank cells

Hi Mike
I will use yours, thanks, I used the other one because I thought it might
need the error checking.
jr.

"Mike H" wrote:

Janis,

I gave you the code in your previous post,

Sub deleteit()
Set myRange = Range("M1", Range("M65536").End(xlUp))
myRange.SpecialCells(xlCellTypeBlanks).EntireRow.D elete
End Sub

Right click the sheet tab, view code and paste it in.

Mike


"Janis" wrote:

Hi
I get a runtime 1004 application or object defined error when I run this. I
want to delete the rows with blanks in column "M".

TIA
-------------code---------

Public Sub deleteRows()



Dim rngToDelete As Range

With ActiveSheet
On Error Resume Next
Set rngToDelete = .Range(.Range("M1"), .Cells(Rows.Count,
"M").End(xlUp)).SpecialCells(xlCellTypeBlanks)

On Error GoTo 0
End With

If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete


End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default runtime 1004 error on deleting rows with blank cells

Maybe it doesn't need error checking since it only removes the blank cells
and if there is none it won't delete anything.
thanks,

"Mike H" wrote:

Janis,

I gave you the code in your previous post,

Sub deleteit()
Set myRange = Range("M1", Range("M65536").End(xlUp))
myRange.SpecialCells(xlCellTypeBlanks).EntireRow.D elete
End Sub

Right click the sheet tab, view code and paste it in.

Mike


"Janis" wrote:

Hi
I get a runtime 1004 application or object defined error when I run this. I
want to delete the rows with blanks in column "M".

TIA
-------------code---------

Public Sub deleteRows()



Dim rngToDelete As Range

With ActiveSheet
On Error Resume Next
Set rngToDelete = .Range(.Range("M1"), .Cells(Rows.Count,
"M").End(xlUp)).SpecialCells(xlCellTypeBlanks)

On Error GoTo 0
End With

If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete


End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default runtime 1004 error on deleting rows with blank cells

My thoughts exactly

"Janis" wrote:

Maybe it doesn't need error checking since it only removes the blank cells
and if there is none it won't delete anything.
thanks,

"Mike H" wrote:

Janis,

I gave you the code in your previous post,

Sub deleteit()
Set myRange = Range("M1", Range("M65536").End(xlUp))
myRange.SpecialCells(xlCellTypeBlanks).EntireRow.D elete
End Sub

Right click the sheet tab, view code and paste it in.

Mike


"Janis" wrote:

Hi
I get a runtime 1004 application or object defined error when I run this. I
want to delete the rows with blanks in column "M".

TIA
-------------code---------

Public Sub deleteRows()



Dim rngToDelete As Range

With ActiveSheet
On Error Resume Next
Set rngToDelete = .Range(.Range("M1"), .Cells(Rows.Count,
"M").End(xlUp)).SpecialCells(xlCellTypeBlanks)

On Error GoTo 0
End With

If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete


End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default runtime 1004 error on deleting rows with blank cells

Mike:

I got an erorr 400 while running this code:


Option Explicit

Public Sub deleteRows()

Dim rngToDelete As Range


Set rngToDelete = Range("M1", Range("M65536").End(xlUp))
rngToDelete.SpecialCells(xlCellTypeBlanks).EntireR ow.Delete


End Sub

"Mike H" wrote:

Janis,

I gave you the code in your previous post,

Sub deleteit()
Set myRange = Range("M1", Range("M65536").End(xlUp))
myRange.SpecialCells(xlCellTypeBlanks).EntireRow.D elete
End Sub

Right click the sheet tab, view code and paste it in.

Mike


"Janis" wrote:

Hi
I get a runtime 1004 application or object defined error when I run this. I
want to delete the rows with blanks in column "M".

TIA
-------------code---------

Public Sub deleteRows()



Dim rngToDelete As Range

With ActiveSheet
On Error Resume Next
Set rngToDelete = .Range(.Range("M1"), .Cells(Rows.Count,
"M").End(xlUp)).SpecialCells(xlCellTypeBlanks)

On Error GoTo 0
End With

If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete


End Sub

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
runtime error '1004' application or object defined error Janis Excel Programming 4 November 18th 09 03:01 PM
unable to protect cells in macro sheet b/c runtime error 1004 rldjda Excel Worksheet Functions 1 March 20th 08 08:28 PM
Hiding Rows Error - "Runtime Error 1004 - Unable to set the hidden property of the range class" Punsterr Excel Programming 2 April 9th 07 05:32 PM
Runtime Error 1004??? kewlrunnings Excel Programming 5 October 25th 05 07:34 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


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

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

About Us

"It's about Microsoft Excel"