Custom Cell Formatting

C

Corey

Okay, I know you can enter in @*- in the custom formatting
for continued dashes across the cell,

Invoice---------

but what if I want dashes on both side of the text? For
example,

----------Invoice----------

Can this be done in the custom format or do I have to
manually enter in all the dashes?

Any help is much appreciated.

Corey
 
G

Gord Dibben

Corey

I don't know of a format that will do this.

If you have a great whack of these to do you could enter a few dashes in a
cell by itself, say A1 has -------

Assuming Column B contains Invoice or any other non-custom formatted text.

In C1 enter =$A$1 & B1

Drag/copy down Column B

Copy Column C and paste special>values>OK>Esc.

Now Format Column C to @*-

OR use a macro to add dashes to the left side of your pre-formatted
Invoice-----

Sub Add_Text_Left()
Dim Cell As Range
Dim moretext As String
Dim thisrng As Range
On Error GoTo endit
Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
moretext = InputBox("Enter your Text")
For Each Cell In thisrng
Cell.Value = moretext & Cell.Value
Next
Exit Sub
endit:
MsgBox "only formulas in range"
End Sub


Gord Dibben Excel MVP
 
C

Corey

I actually don't have many to do. I just use that "look"
on many of my spreadsheets. Thanks for the help!!

Corey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top