How does one pass an if condition in Textjoin into the VBA equivalent? ie. my working formula in Excel currently is:
=TEXTJOIN("",TRUE,IF(M1:M100=1,N1:N100,""))
This is to join rows in column N if the flag is set in column M.
What I am trying to get is to replicate this in VBA, something like:
abc = WorksheetFunction.TextJoin(" ", True, IF(Range(M1:M100)=1,Range(N1:N100),"")
But can't seem to work out how to pass the criteria to the worksheet function. Any ideas?
I guess the question also relates to WorksheetFunction.Filter, on how you can pass a filter condition to it, something like:
WorksheetFunction.Filter(Range("M:M"), Range("N:N") & "=1", False)
I say this as if I can work out the filter, I can probably just pass that range to the text join directly.
Thanks!
