PC Review


Reply
Thread Tools Rate Thread

Delete rows if value from cell is not in list Options

 
 
bony_tony
Guest
Posts: n/a
 
      3rd May 2007
Hi,
Someone has given me the following code for my previous post.
But i'm getting an error. It's highlighting "Application", and says
"Expected: Then or GoTo"

firstRowFound = True
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 6 To lastRow
If Not Iserror Application.Match(Range("D" & i), _
Worksheets('All Invoices').Columns(4),0)) Then
If firstRowFound = True Then
Rows(i).Select
firstRowFound = False
Else
Union(Selection, Rows(i)).Select
End If
End If
Next i
Selection.Delete Shift:=xlShiftUp

It looks ok to me, there's a "Then" at the end of the statement....
Any ideas?

Tony

 
Reply With Quote
 
 
 
 
Norman Jones
Guest
Posts: n/a
 
      3rd May 2007
Hi Tony,

Try replacing:

> If Not Iserror Application.Match(Range("D" & i), _
> Worksheets('All Invoices').Columns(4),0)) Then


with

If Not IsError(Application.Match(Range("D" & i).Value, _
Worksheets("All Invoices").Columns(4), 0)) Then


--
---
Regards,
Norman


"bony_tony" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
> Someone has given me the following code for my previous post.
> But i'm getting an error. It's highlighting "Application", and says
> "Expected: Then or GoTo"
>
> firstRowFound = True
> lastRow = Cells(Rows.Count, "A").End(xlUp).Row
> For i = 6 To lastRow
> If Not Iserror Application.Match(Range("D" & i), _
> Worksheets('All Invoices').Columns(4),0)) Then
> If firstRowFound = True Then
> Rows(i).Select
> firstRowFound = False
> Else
> Union(Selection, Rows(i)).Select
> End If
> End If
> Next i
> Selection.Delete Shift:=xlShiftUp
>
> It looks ok to me, there's a "Then" at the end of the statement....
> Any ideas?
>
> Tony
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Rows if any cell in Column H is blank but do not Delete Fir =?Utf-8?B?bWFuZmFyZWVk?= Microsoft Excel Programming 4 28th Sep 2007 05:20 PM
Delete rows if value from cell is not in list bony_tony Microsoft Excel Programming 1 1st May 2007 08:25 AM
do not delete rows in a list. =?Utf-8?B?c3RldmVu?= Microsoft Excel Programming 1 29th Mar 2007 05:15 PM
NEED TO HAVE A LIST OF SPECIFIC OPTIONS OF DATA IN CERTAIN ROWS =?Utf-8?B?c2FyYQ==?= Microsoft Excel Worksheet Functions 1 4th Oct 2004 01:39 PM
Delete a list of rows John Fevens Microsoft Excel Programming 3 18th Jun 2004 01:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:12 PM.