LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Joe
 
Posts: n/a
Default Macro error : Application-defined or object-defined error

Hi,

I have a worksheet "Filtered OSMI". I want a macro to go through each
row, and if the entry in column D is less than 50, I want to delete
that row. The same process should run until I hit a blank cell in
column D. I tried the following macro, but it given the error
"Application-defined or object-defined error". Could you tell me what I
am missing here?

Sub OSMIvalcheck()

Dim c As Range 'current
Dim N As Range 'next
Dim dolval As Variant
Dim i As Variant

Set c = Worksheets("Filtered OSMI").Range("A2")

i = 2

Do While Not IsEmpty(c)
Sheets("Filtered OSMI").Select
dolval = Worksheets("Filtered OSMI").Cells(i, "D").Value
If dolval < 50 Then
Range(i, "D").EntireRow.Delete
Else
Set N = c.Offset(1, 0)
Set c = N
i = i + 1
End If
Loop
End Sub


Thanks,

Joe.

 
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
Macro error after switching from Excel 2000 to Excel 2003 Jake Burnham Excel Discussion (Misc queries) 1 January 10th 06 08:10 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
run macro error, please help [email protected] Excel Discussion (Misc queries) 0 February 8th 05 03:52 AM
macro error when opening any file psp Excel Discussion (Misc queries) 1 January 31st 05 04:33 PM
macro error at cell Newtek Excel Worksheet Functions 1 November 18th 04 07:08 PM


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