View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Multiple Criteria - Shortening Code

you need the step if going from the bottom up. You don't need the IF more
than once.You don't need to select.
for i=100 to 1 step-1
if cells(1,i)<"GM" and cells(1,i) < "tURNOVER" then
cells(1,i).entirecolumn.delete
next i

Are you trying to delete more than one column? If not, then use FIND to find
the column to delete. You could use select case for lots of criteria

--
Don Guillett
SalesAid Software

"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