Select Case

HYKE

Active Member
Joined
Jan 31, 2010
Messages
373
How to re-write this code better?
Code:
 Sub delType() Select Case Range("H:H").Value
 
 Case "Cred Memo (Val Only)", "Debit Memo(Val Only)", "Debit Memo (Val&Qty)", "Debit Memo Service", "NC Replc Ord/No rtrn", "Quotation", "Order Worksheet", "Rebate Part Settlmnt", "Rebate Manual Accrls", "Reb Accr Correction", "Reb Cr Req - Final", "Return w/ Auto Deliv", "Rtrns f/Internal Use", "Consignment Pick-up", "Return Non Value", "Intra-cross FE Rtn", "Goodwill", "Internal Usage", "Export Documentation", "Consignment Fill-up", "AMMAN", "Standard Order", "EA", "SO/PO Intracompany", "SO/PO Intra-cross", "Intercompany SO/PO"
    Range("A:A").Value = "X"
 End Select
 End Sub

Thanks!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I want to have the columns that contains below words to be deleted instead (entire row).

"Cred Memo (Val Only)", "Debit Memo(Val Only)", "Debit Memo (Val&Qty)", "Debit Memo Service", "NC Replc Ord/No rtrn", "Quotation", "Order Worksheet", "Rebate Part Settlmnt", "Rebate Manual Accrls", "Reb Accr Correction", "Reb Cr Req - Final", "Return w/ Auto Deliv", "Rtrns f/Internal Use", "Consignment Pick-up", "Return Non Value", "Intra-cross FE Rtn", "Goodwill", "Internal Usage", "Export Documentation", "Consignment Fill-up", "AMMAN", "Standard Order", "EA", "SO/PO Intracompany", "SO/PO Intra-cross", "Intercompany SO/PO"How to write the code?Thanks!
</pre>
 
Upvote 0
Maybe

Code:
Sub delType()
Dim LR As Long
Dim i As Long
LR = Range("H" & Rows.Count).End(xlUp).Row
For i = LR To 1 Step -1
    Select Case Range("H" & i).Value
        Case "Cred Memo (Val Only)", "Debit Memo(Val Only)", "Debit Memo (Val&Qty)", "Debit Memo Service", "NC Replc Ord/No rtrn", "Quotation", "Order Worksheet", "Rebate Part Settlmnt", "Rebate Manual Accrls", "Reb Accr Correction", "Reb Cr Req - Final", "Return w/ Auto Deliv", "Rtrns f/Internal Use", "Consignment Pick-up", "Return Non Value", "Intra-cross FE Rtn", "Goodwill", "Internal Usage", "Export Documentation", "Consignment Fill-up", "AMMAN", "Standard Order", "EA", "SO/PO Intracompany", "SO/PO Intra-cross", "Intercompany SO/PO"
        Rows(i).Delete
    End Select
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,203,687
Messages
6,056,747
Members
444,888
Latest member
Babi_mn

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