Excel UnderLine Interior Border

DiverDan

Well-known member
Joined
Jan 16, 2003
Messages
645
Location
Sacramento, CA
User Rank
*Experts*
Im having a tough time trying to add an underline border in a specific Excel Worksheet cell and need some help.

Code:
With excelWorksheet
blah, blah
    .Cells(row, col).Borders... it always crashes here
End With

Thanks,
Dan
 
Hi SonicBoomAu,

I had looked at your previous post earlier and am trying to get the interior border of a single cell as a bottom line.
 
Hi DiverDan,

Have you tried using .range instead of .cells?

Could you apply border around the required cell, then set the border around the ajoining cell to no border?

I.E.

[VB]
With objSheet
.Range("C2").BorderAround()
.Range("B2").BorderAround(BorderStyle.None)
.Range("C1").BorderAround(BorderStyle.None)
.Range("D2").BorderAround(BorderStyle.None)
End With
[/VB]

Havent tried, but I think it would do the job. Not the best but might be able to get you past this spot until someone else knows how to fix.

P.S. Just found this web site
http://support.microsoft.com/default.aspx?scid=kb;en-us;213622

[VB]
With range("C2").Borders(Excel.XlUnderlineStyle.xlUnderlineStyleSingle)
.Weight = Excel.XlLineStyle.xlContinuous
.ColorIndex = 3
End With
[/VB]

Hope this helps
 
Thanks SonicBoomAu!!!!

This works great for the main lines...Ill work on the individual cells later.
Code:
With excelWorksheet
Blah, Blah
    With .Range("A1:F1").Borders(Excel.XlBordersIndex.xlEdgeBottom)
        .LineStyle = Excel.XlLineStyle.xlContinuous
        .Weight = Excel.XlBorderWeight.xlThin
        .ColorIndex = Excel.XlColorIndex.xlColorIndexAutomatic
    End With
End With

I really cant thank you enough as this was the last bit needed for a special report due tommorrow morning at 8:00 am.

Thanks,
Dan
 
Back
Top