Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Delete rows if value from cell is not in list Options

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Delete rows if value from cell is not in list Options

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" wrote in message
oups.com...
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
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
Drop down list options dependent on cell value mt Excel Discussion (Misc queries) 2 March 12th 08 08:59 PM
Delete rows if value from cell is not in list bony_tony Excel Programming 1 May 1st 07 08:25 AM
How do I delete the drop down list of header / footer options in e Progress Finance Excel Discussion (Misc queries) 1 December 1st 05 06:49 PM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
Delete a list of rows John Fevens Excel Programming 3 June 18th 04 01:11 AM


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

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"