You can achieve this result using a custom cell format. For example:-
- Set a Custom number format of
*C@
for the cell.
- Enter a single C in the cell.
- The cell will fill with Cs.
The asterisk tells Excel to repeat the character that's following. In this case the character that follows is a "C". The final @ specifies that the cell should contain text. You can replace this with a 0 (zero) or a more complicated format (like in number formatting).
What happens, then, is that the "C" you entered will be preceded by the number of fill characters the cell can take. If you enter "John" the display will be CCCCCCCCCCJohn. The Formnat *=0.00
would show the number 55.1234 as ==========55.12
The sequence can be reversed with a format like @ *+
which would produce a output like "John +++++++++++".
Unfortunately, I don't know of a way to repeat more than one character, even if the second character is a space. For this kind of thing Excel has the RPT() function. =RPT("C ",5)
will repeat a C, followed by a space, 5 times. Unfortunately, the RPT function doesn't seem to accept Char(10) (Alt + carriage return), limiting its use to fill cells vertically. Also, one would have to adjust a cell to the width of the function's output instead of the output being adjusted to fit the cell width.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…