Thread: If X = Array?
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PaulW PaulW is offline
external usenet poster
 
Posts: 130
Default If X = Array?

I have a report that contains a list of account codes in column A, and I'm
trying to build a userform, that can give performance figures by department /
company / section.

So what I need to do, is have the userform rename the account codes, by
adding a suffix to define which department they belong to. What I have so far
is something along the lines of:

If Left(Cells(i, 1), 6) = "AAL060" Then n = 1
If Left(Cells(i, 1), 6) = "AAL064" Then n = 1

But the list of account codes is about 50 long, and I don't want 50 lines of
if statements if I can avoid it.

Is there some way I can have :

If Left(Cells(i, 1), 6) = "AAL060"&"AAL064"&"PFF800" Then n = 1

So its only 1 check against a list?