This two-step find-replace routine gets you from MAX( MAX( MAX( to exprS = exprS & TrimRight("MAX( ") & _ exprS = exprS & TrimRight(" MAX( ") & _ exprS = exprS & TrimRight(" MAX(") & _