Hi Everyone
I am working on a macro where I need find the column number which contains a particular text. However the noted cell is merged with others. I prefer to not unmerge the cells. Is there a way to make the match function work with merged cells? If match is not the way to go then I am open to other ways. In the end, I just need to find the column number where the text is located.
First attempt:
target_location=application.match("YTD",sheets(counter1).rows("7:7"),0)
Second attempt:
target_location=application.match("YTD",sheets(counter1).rows("7:8"),0)
The merged cell is rows 7 and 8 so I thought second attempt would work. No luck. The compiler ran an error at this line.
Any thoughts?
I am working on a macro where I need find the column number which contains a particular text. However the noted cell is merged with others. I prefer to not unmerge the cells. Is there a way to make the match function work with merged cells? If match is not the way to go then I am open to other ways. In the end, I just need to find the column number where the text is located.
First attempt:
target_location=application.match("YTD",sheets(counter1).rows("7:7"),0)
Second attempt:
target_location=application.match("YTD",sheets(counter1).rows("7:8"),0)
The merged cell is rows 7 and 8 so I thought second attempt would work. No luck. The compiler ran an error at this line.
Any thoughts?
Last edited: