-
Runtime 424 Error "Object Required
Hi, I'm learning vba and get past the above error. Here's the code (to remove duplicated rows in a list).
[VBA]Sub CleanList()
Range("A1").Select
Do While Not IsEmpty(ActiveCell.Offset(1, 0))
CheckCell = ActiveCell.Value
If CheckCell = ActiveCell.Offset(1, 0) Then
ActiveCell.Offset(1, 0).Delete.EntireRow
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub[/VBA]
HELP!!
-
Welcome to VBA Express!
[vba]ActiveCell.Offset(1, 0).EntireRow.Delete[/vba]
-
Ouch!
It now works !! (that was a stupid mistake).
Thanks a lot!
-
Hi,
About this Runtime Error 424, you will usually encounter Runtime Error 424 when trying to use Microsoft Office Chart and Microsoft Access 200 at the same time. The solution is easy – just uninstall Internet Explorer 6.0. Instead, try using Mozilla Firefox or Opera. These are excellent choices for web browsers and they do not clash with MS Chart or MS Access. Of course, you can try and avoid using MS Chart and MS Access at the same time, but this isn't always possible. If you do choose to go this route, click on the chart and select "property toolbox."
-
Generally it is better to delete(insert) from the bottom up. Also, try to avoid selecting cells: your code will run more quickly
[vba]
Option Explicit
Sub CleanList()
Dim LRw As Long
Dim i As Long
LRw = Cells(Rows.Count, 1).End(xlUp).Row
For i = LRw To 2 Step -1
If Cells(i, 1) = Cells(i - 1, 1) Then Rows(i).Delete
Next
End Sub
[/vba]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules