Email:      Pass:    Pass?
Close Window   
Subscribe for Email Updates!
Excel tips, help, and more!


Free Excel Forum


Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

I am looking for information on inserting an underline. I do not want the
underline under just the number and I don't want the border option. I belive
there is a format option that will make a line that goes across the cell but
just short of the end of the cell edges. I would appreciate any ideas. I
have seen it before but cannot remember that options to format the line this

Similar Excel Video Tutorials

Helpful Excel Macros

Format Cells in The Short Date Number Format in Excel
- This free Excel macro applies the Short Date number format to a selection of cells in Excel. This number format display
Format Cells in The Number (Numerical) Number Format in Excel
- This free Excel macro formats selected cells in the Number or Numerical number format in Excel. This means that the cel
Format Cells as Time in Excel
- This free Excel macro formats a selection of cells in the Time format in Excel. This Time number format means that inst
Format Cells as a Scientific Number in Excel Number Formatting
- This free Excel macro formats selected cells in the Scientific number format in Excel. This means the cell will be put
Format Cells as a Fraction in Excel Number Formatting
- This free Excel macro will automatically format a selected cell or many selected cells in the Fraction number format in

Similar Topics

How do I format a cell underline to extend almost the entire width of a cell but not all the way to the edge? (i.e. I'd like an underline longer than simply ctrl + U, but less than entire border underline). Thanks!

I need to format 3 lines of text within the same cell with different styles.

line 1

I am doing this in C# and I tried the following:

Range.Font.Underline = true;
Range.Value2 = "line 1";
Range.Font.Underline = false;
Range.Font.Bold = true;
Range.Value2 = Range.Value2 + "line 2";

The problem lies within the concatenation of "line 2" to "line 1". Since I turned off underline after line 1 and turned on bold, the concatenation reformats the value to bold, and "line 1" is no longer underlined.

Anyeone have any ideas as to how to retain the underline for "line 1"?

There is a short cut to underline word by choosing pictuorial U. How about to
underline a word that the line is by dot ?

I wish the line same as the word length and not by drawing.


Any suggestions on overlining a cell contents so it can match up with the
underline in Accouting format. Do not want to do borders because it defeats
the purpose of Accounting format underline. I want to apply formatting to
the cell itself rather than doing an underline in cell above it.

Is it possible to underline text with differenet color?

Text is let say std. black, and need red underline.

(I can change color of cell down but I would like underline line in right test test.


Everytime I open a new file, there is a predetermined underline for Row 1. It is not the border, because even if I eliminate that, there is a distinctive underline remaining. It is almost as if it is pre-destined to be a header row. Normally, I like it, but in some cases I don't want a header row. If I delete Row 1, everything moves up, but Row 1 stays underlined. Any thoughts?

I am trying to add a double underline into a specific row (Cell "A" & row). The row can change so I cannot code the position. Initially I had the text coded with a double underline, but my user wants some space between the text and the underline, which led me to try using the shape object. How would I change the following code:


With Sheets(shtRpt).Shapes.AddLine(0, 100, 132, 100).Line
                .Style = msoLineThinThin
                .Weight = 3#
            End With



I am hoping someone can assist me. I'm fairly new to VBA and need the following done:
I have several sheets which have conditional formatting that underlines names which match the sheet name (e.g. "John" and "Mary") When I group the sheets into a "master" sheet, I would like the underline format to remain to indicate the original source sheets At present, the underline is lost as the conditional format recognises the "master" sheet name than the original sourced sheet names Is there a way to retain the underline format without underlining the relevant cells manually? Help!

I have a worksheet that has a subject listed for each month of the year by
weeks. My question is how do I under line the last week of every month
completely across the columns? I can underline by each word separately but
want the whole thing underlined. Also when I have a line in BOLD that has to
been underlined and I have narrowed the row space, it seems the underline
causes the top of the letters in the BOLD row to be cut off. So guess I have
two separate questions needed to be answered.

I have a value (numeric) in cell A1.

Then in cell B1, I have the follwoing formula:

="The result is"&A1.

So if I have a number 50 in A1, B1 will look like:

The result is 50.

How do I make that

The result is 50.


I reckon I need to use the TEXT(REF,FORMAT) function but I do not know how to express the UNDERLINE format in the custom formatting.


My spreadsheet contains an unusual underline that I cannot remove.
Neither the Borders or the Underline commands remove it.
It is not the dotted line subscribing a page to be printed.
I'm stumped.

I am attempting to write some code to look at all the cells in the worksheets in a workbook, detect when that cell has a dotted underline, and all the cells next to it with the same dotted underline, then merge those cells together.

The first problem I have encountered is that the dotted underline that these cells have (I was given some 100 workbooks to process) are not the xlDot linestyle. I don't know what they are. When I do a Debug.Print on the linestyle, it comes back as xlContinuous, but they are small dots, not a solid line.

To see which style it is, if you were to apply a border to a cell manually, it is the border directly under the "None" style. The second style under "None" is the xlDot style (as I found out by some testing). But the first one shows as xlContinuous, and I cannot figure out how to tell that from the solid continuous lines.

So, my question is, how can I tell this sytle, from a solid border?



I am trying to write a custom cell format that would allow me to replace the comma with a space after the thousand's place. Therefore, 1 million would look like: 1 000 000 instead of 1,000,000. I do NOT want to change my regional settings to accomplish this.

When I write ### ### ### it accomplishes this, however, there is one small glitch. When you apply an "underline" you get the following result:

_1 000
_10 000
_100 000
1 000 000
10 000 000
100 000 000

The underline does not lineup evenly with the "ones" digit until we reach 1 million. I want to write a universal format in which the underline lines up evenly regardless of the number.

Does anyone know how to fix this?

Thanks in advance,

Hi all

For some reason (and I have searched and searched) I can't find an option in Excel 2003 to underline misspelt words with a red line.

Can someone stop me losing my mind and point it out.

I bet after all this its as obvious as hell



So basically I'm trying to pull formatting from 1 cell to another(automatically updating as well). (format being font color and underline). I know this will not work with the normal excel formulas so I've been playing with VBA.

To test this I have a worksheet where B1's text is underlined. In cell C1 I'm running this:

=uline(B2, B1)

which runs this function

Function uline(CurCell As Range, LookupTable As Range)
    uline = ""
    For Each Access_Cell In LookupTable
        If Access_Cell.Font.Underline = xlUnderlineStyleSingle Then
            CurCell.Font.Underline = xlUnderlineStyleSingle
            CurCell.Font.Color = RGB(255, 0, 0)
        End If
    Next Access_Cell
End Function

Right now the if statement is only detecting underline to make sure it works. The color part works - it will color the "CurCell" if the "LookupTable" is underlined, but after much painstaking trial runs I cannot get it to change the underline value. I tried for a while to call the function in the cell that I wanted to underline (by having a string as a parameter and then spitting it back out at the end) but same problem with no underline.

Is there a way to do this? I need the cell's format to update automatically if the referencing cell's format changes. And I'm pretty sure I need to pass the ranges as parameters as in the real case I'll be accessing data on another worksheet.
A macro might work as the cell won't update unless I click on the formula cell and then press enter. Is there a way to pass range parameters to a macro though?

I'd appreciate any help! thanks!


I've found an interesting (and very annoying) trait of excel and wondering if it is a bug or whether I'm doing something odd.

Relates to Excel 2002 - SP3

Basically I have text in a cell at font size 11. This text is made up two or more sentences each split with ALT-RETURNS.

The first sentence is then formated with UNDERLINE.

All good thus far.

Each month this gets updated and I've set up a routine to copy/paste special-values over the top.

Excel decides to format the whole cell with UNDERLINE. So I have to go through each, highlight everything bar the first sentence and remove UNDERLINE.

Excel then decides to change the font size from 11 to 6.5 on all text I've removed the UNDERLINE from.

Any thoughts?



i have a sheet with cells that have this format
abchhdh_dsfsdf_sdfsdf_asd_dd_adfdf_fff .....
i dont know the number of underline in each cell
and i dont know how many characters are betwin two underline
how i can seperate each cell for example i want to make below format
"abchhdh" in one cell ,in the next cell "dsfsdf" ,in the next cell "sdfsdf" and so on
many thanks

I've been doing alot of research for the past week on this topic and came up with top two answers .
1. you cant do it
2. you can do it but only if it is broken up.
3. find another option.

lets say i want to do this.

and have been trying really hard to find en number of ways.

code 1 by pgc01
Private Sub Worksheet_Change(ByVal Target As Range)
Dim s1 As String, s2 As String

' only if D1 changes
If Target.Address "$D$1" Then Exit Sub

' write the text in A1
s1 = " The Agreement between (The ""Company"") and "
s2 = " (The ""Customer"")"
Range("A1") = s1 & Range("D1") & s2

' add underline to the format of the words "Company" and "Customer"
Range("A1").Characters(InStr(1, Range("A1"), "Company", vbTextCompare), Len("Company")).Font.Underline = True
Range("A1").Characters(InStr(1, Range("A1"), "Customer", vbTextCompare), Len("Customer")).Font.Underline = True

End Sub

(i have been hopping)
code 2 from
Function CopyNumberWithOneUnderlinedCharacter(ByVal myCell As Range)
Dim l_Position As Integer
For l_Position = 1 To Len(myCell.Value)
If myCell.Characters(Start:=l_Position, Length:=1).Font.Underline _
xlUnderlineStyleNone Then

CopyNumberWithOneUnderlinedCharacter.Characters(St art:=l_Position,
Length:=1).Font.Underline = xlUnderlineStyleSingle
End If
Next l_Position
End Function
therse were the best two answers i could find out for underlineing a part of a sentence in a cell.

now my question here is for some one who can put up a function for a sell only or formatting.

for example
A1 = The
B1 = Cow
C1 = jumped
D1 = over
E1 = the
F1 = moon.

lets say my data is like this. if i really want to join the sentense all i have to do is "=A1&B1&C1&D1&E1&F1" (without quots)

can someone come up with a function to underline just 1 cell

hypothetically C1

thus bringing me to a formula
"=A1&B1&underline(C1)&D1&E1&F1" (without quots)

ideally this should be the case isnt it ?

Any suggestions on how to go about this.... i've just theorized the theory.

Some one help me put this in motion.

Is there any way, simple or otherwise, to create an overline?

For example, have the length of the underline of the cell based on a the number of characters in the cell below it as in a total.

instead of:


Thanks a million. mikeburg

Is there any way, simple or otherwise, to create an overline?

For example, have the length of the underline of the cell based on a the number of characters in the cell below it as in a total.

instead of:


Thanks a million. mikeburg

Hi Guys,

Attached is a test spreadsheet I am trying to tweak. Column B contains dates of courses starting and I have to currently manually add a Thick underline border to make different days stand out more.

What I wanted to know is there a way to make a macro that will automatically search column B and when it finds two dates it will automatically underline a thick line from Columns A all the way to Column I so that I don't have to constantly manually add them when new dates are added.

If anyone out there can help me in my plight then I would be eternally grateful.

Thanks in advance.

I've tried searching and couldn't find anything with regards to the following:

I'm creating a user form that allows the user to make certain inputs.There are various columns on the user form. I'm using the label icon on the toolbox to create the headings.

Request - I'm trying to underline the heading - but I can't find any underline function (similar to the underline icon in excel). Is it not available on the user form?

Does anyone have any other suggestions because I will be requiring some type of underlining format on my other pages on the userform as well.

Thank you.


When I am creating a spread sheet I sometimes use the bold and underline features for the headings. Sometimes when I change from one cell to another using the left and right arrow keys I find the bold and underline features are also being selected, even though I don't want to use them anymore. Is there a way to stop this happening, it is driving me crazy.

Thanks, Mickmac


When I am creating a spread sheet I sometimes use the bold and underline features for the headings. Sometimes when I change from one cell to another using the left and right arrow keys I find the bold and underline features are also being selected, even though I don't want to use them anymore. Is there a way to stop this happening, it is driving me crazy.

Thanks, Mickmac

Anyone know a simple formula that will change the way a value "looks" under a givin condition?

Doesn't have to be a huge change, just noticable. Like make it a different color or underline it or something.

Something like:

in A1, if A2 = "whatever" then underline font or something

Its just so that when someone looks at all the different times on a sheet they can see that some of them relate to something different.

I don't need a whole code. Just need to be pointed in the right direction. Like what the command for it would be.