943,543 Members | Top Members by Rank

Ad:
Oct 24th, 2008
0

I Need your help, Please

Expand Post »
Hi, all programmers of this Forum, I am using MS Axcel 2002 and I am trying to format Excel Sheet from VB so as to make a border within the selected cell. My CB code is as under and when I run this, it select the specified rangge, but no line / border is made. It simply finished.


CODE USED:

X.ActiveSheet.Range("A16:U48").Select
selection.Borders(xlDiagonalDown).LineStyle = xlNone
selection.Borders(xlDiagonalUp).LineStyle = xlNone

With selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With


For changing color of text to Red, I used this code as below, and it work correctly:

'Selected range colour nan
X.Range("B2").Select
With selection.Font
.Name = "Arial"
.fontStyle = "Bold"
.Size = 10
.Strikethrough = False
.superScript = False
.subScript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With



Can any one give the the solution for above problem?
Reputation Points: 10
Solved Threads: 4
Light Poster
K.Vanlalliana is offline Offline
44 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Vb flexgrid
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: question only





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC