View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Multiple Criteria - Shortening Code

Dim i As Long
Dim aryTest

aryTest = Array("GM", "Turnover", "Contribution", "etc") '<=== Update

For i = 100 To 1 Step -1
If Not IsError(Application.Match(Cells(1, i).Value, aryTest, 0))
Then
Columns(i).Delete
End If
Next i


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"T De Villiers"
wrote in message
news:T.De.Villiers.2bpig2_1154176206.1429@excelfor um-nospam.com...

following is my code:

For i = 100 to 1

If cells(1,i) < "GM" AND If cells(1,i) < "tURNOVER" AND If cells(1,i)
< "cONTRIBUTION" AND............Then
Selection.EntireColumn.Delete

There are 15 criteria, how do I shorten my code, maybe using an array?
not sure.

Thanks


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile:

http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=566269