| | |
I Need your help, Please
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2008
Posts: 44
Reputation:
Solved Threads: 3
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?
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?
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Vb flexgrid
- Next Thread: question only
Views: 381 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





