Here's my problem.
I have an excel sheet with a merged cell (it is three columns merged into one). I would like a script to set the row height to just fit the contents of the merged cells. The cell in question will have a varying amount of text (unpredictable).
I have found a few rather complicated VBA scripts floating around, but I was thinking of the following "easy" work-around, though I haven't gotten it work just yet.
Here's the plan: I will link the text from the merged cell to a non-merged cell on a much lower and further right part of the current worksheet (or on a new worksheet if that's helpful). The cell with the copied data will be of the same width as the merged cell on the main part of the worksheet.
I will use the .autofit method on the copied cell (which should work because it's not a merged cell), will then copy the height of that cell to a variable, then set the height of the merged cell to be the same as the variable.
e.g.
A1:C1 are merged into A1
A1 (merged) is 5 inches wide (with a lot of text it in)
set E5 width to 5 inches wide
set E5 to "=A1"
run script
script
rows(5).autofit
RH = rows(5).RowHeight
rows(1).RowHeight = RH
Assuming the plan will work, I need help with the script syntax.
Thanks in advance!
Bookmarks