Is there any way to tell macro to skip some lines of the macro if a statement if not true?

Dear all,
I have a macro with a lot of functions and stuff.

I would like to tell macro to skip part of the macro (e.g. from line 150 till line 240) if title of my images contain a specific word.

Does anyone have any clue how to do it?

Best,
Miguel

if(indexof(title,specificword) < 0){

lines 150-240

}