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: 2
Default run-time error '1004': Application-defined or object-deifined error

I am getting this error with the following Macro any help would be
appreciated.


Sub Process_Service_Fees()

Dim RangeDepth As String
Dim RangeDepth2 As String

RangeDepth = Worksheets("Sheet1").Range("F3").Value

For Each MyObject In Worksheets("Sheet1").Range("A1:A" & RangeDepth)
' Iterate through each element.

If MyObject.Value = "" Then '
If Cell is empty
Rows(MyObject.Row & ":" & MyObject.Row).Select
'Delete the row
Selection.Delete Shift:=xlUp
'Shift next line up one
End If
Next

RangeDepth2 = CInt((Worksheets("Sheet1").Range("F2").Value) / 1.5)

For Each MyObject In Worksheets("Sheet1").Range("A1:A" & RangeDepth2)
' Iterate through each element.

If MyObject.Value = "" Then '
If Cell is empty
Rows(MyObject.Row & ":" & MyObject.Row).Select
'Delete the row
Selection.Delete Shift:=xlUp
'Shift next line up one
End If
Next

Columns("F:F").Select 'Delete empty columns.
Selection.Delete Shift:=xlToLeft ' These three columns are
always empty
'Columns("J:J").Select ' and do not change, unless
file layout
' Selection.Delete Shift:=xlToLeft ' changes.
'Columns("L:L").Select
' Selection.Delete Shift:=xlToLeft

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
Error 1004 Application Defined or Object Defined Error Garry[_6_] Excel Programming 2 October 1st 04 10:33 AM
Macro Run-time Error 1004 Application Defined or Object Defined Error Anddmx Excel Programming 6 June 9th 04 03:40 PM
"Run Time Error 1004 Application Defined or Object Defined Error." BJC Excel Programming 4 October 26th 03 03:09 AM
Runtime Error 1004 -- Application Defined or Object Defined Error John[_51_] Excel Programming 3 September 4th 03 04:28 PM


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