AHHHHHHHH - it not working ... it looks like it should

shadow12345

Well-known Member
Joined
May 10, 2004
Messages
1,238
Hi,

I have this sheet
Control Sheet - Broker Review.xls
ABCDEFGH
1RefNameBookTrade CountTotal SharesTotal CashExchangeBook Match
211427TULLETT PREBON 740KES142861434126462159.8EAVdelete
319339EXANE#IHA1875270593.75EAVdelete
4264AMS EFFECTEN AEKFIEC1550001282985EBB21
5266NATL BK OF CANADAKBSA13113100065914100EBBdelete
62233BRINSON A/C PDP6EUR219037159819.35EBBdelete
710537KREDIETBANK SECSCFEE6947902192406.71EBBdelete
Raw Data


what i am trying todo is delete the row if the value in H is delete, i am using the code below but it not working ........... any thoughts

Code:
Sub deleterows()
        Range("H2").Select
    
account = "delete"
For i = Range("h5000").End(xlUp).Row To 1 Step -1
If Range("h" & i) = account Then Rows(i).Delete
Next i
End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Without checking anything else it looks like :-
Code:
If Range("h" & i) = "delete" Then .........
 
Upvote 0
Although you don't need this line:

Range("H2").Select

It seems to work fine on my end, what is it not doing?
 
Upvote 0
Are there any spaces before or after the word delete in the cells?
 
Upvote 0

Forum statistics

Threads
1,226,287
Messages
6,190,070
Members
453,593
Latest member
Mubashar Ali

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top