When you write an If statement such as:
If Category = "CM" or Category = "M2" or Category = "P1" or Category = "ZZ" thenProcessEmployeeEndif
it can be simplified by:
dim ValidValues as stringValidValues = "CM M2 P1 ZZ" ' don't forget to insert any ' categories between P1 and ZZif (instr(1, ValidValues, Category)) > 0 thenProcessEmployeeendif
Not only does this version not require you to go on scrollinghorizontally while writing the code but is faster as well, basedon simple tests I conducted using VB3 on a 486DX-66. Note thatI have used a space to separate categories in ValidValues string.You may use any separator, such as semicolon, comma, etc. If youdo not use a separator, the ValidValues string will become “CMM2P1ZZ”and you might get incorrect results and make the ValidValues stringless readable.