Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incorporating the LEFT function into Code 1

Status
Not open for further replies.

Mizzness

Programmer
May 2, 2003
174
0
0
US
All.

In col.D I have some data that is identified as SP3 & SP 50.
How can I incorpoarate the follwing logic into code ?
=if(left(D1,2)=SP,then delete entire row.

Thanx for any help & guidance.
 
No problem.

One last thing: how do you disengage the filter to show all the data ?
 




1. You could use HELP in VBA.

2. Check out the ShowAllData method.

Skip,
[sub]
[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue][/sub]
 
Another problem:

If the With part, take out the dot before Cells - the one highlighted here:
[tab].Range([highlight] . [/highlight]Cells(1, 1)
Otherwise, it will start its delete on row 10, failing to delete any SPs on rows 6-9.

Personally, I would handle it a little differently, like this:
Code:
Sub YourMacro
[A5].AutoFilter
    [A5].AutoFilter Field:=3, Criteria1:="=SP*"
    Range([C6], [C6].SpecialCells(xlLastCell)).EntireRow.Delete
[A5].AutoFilter
End Sub

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
If the With part" should read "In the With part"

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Exactly what I needed.

Thanks Skip for all you help.
 
It's obviously up to you, but I'd strongly advise you to heed the warning in my last post (well, last full post). Otherwise you will eventually fail to remove rows that you're expecting to remove.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 





oops! John is correct!!! [blush]

Just remove the DOTS before the TWO Cells objects.

Skip,
[sub]
[glasses]Did you hear what happened when the OO programmer lost his library?...
He's now living in OBJECT poverty![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top