Multiple Ifs then condition

Background : My bank sends my different kinds of remittance all wrapped up in 1 text file per remittance. I get around 25-30 remittance daily. I wrote a KM macro which reads the 'type' of remittance and then triggers a macro accordingly.

So Macro goes like

  1. Read Text File
  2. If Line2=A & extension is text then do Macro A
  3. If line2=-B & extension is text then do Macro B
  4. If line10=J & extension is text then do Macro J

My current macro is working fine but I would like to know if there's a better/efficient way of running this ifs scenario.

Yes, in many cases.
See Switch or Case action.

oooh thank you so much. This indeed cut down my macro to very readable size.

If I'm right for my first condition localextension=TXT , I would still need 1 single IF then statement.

You can nest if statements within a Switch/Case statement
1: It helps to group and colour the group so it is more readable
2: there is a default otherwise which should be used to trap errors.

1 Like