Hi,

I have a bunch of cells with either a value, eg "x" or nothing, eg "". I am having a lot of difficulty getting started on an algorithm that iterates through each row (starting in cell A1, then B1, going all the way to H1 before jumping to A2 and repeating the same thing), merging-and-center'ing based on the values in each cell.

Here's how it would work. Start in cell A1. There is an "x" in the cell. Cell B1 is blank (" "), add it to the selection so now the selection is A1:B1. Cell C1 is also blank - add it to the selection; A1:C1. Cell D1 has an "x" in it, now take A1:C1 (excluding D1), merge-and-center, apply outside borders, and start over at D1. If it gets to H1 (the end column) without seeing another "x" (because the remaining cells are all empty) it merges-and-centers D1:H1 then proceeds to A2 and repeats the same process.

Any ideas would be awesome. Thanks.