ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   nesting with statements (https://www.excelbanter.com/excel-programming/373839-nesting-statements.html)

Arnold Klapheck

nesting with statements
 
I was trying to do the following (to get away from the select) but am getting
a "variable not defined" and it is highlighting xlInsideVerticle, or (if I
take out xlInsideVerticle) error msg " wrong # of variables or invalid
property assignment" and .Borders is highlighted, any
suggestions would be appreciated, thanks

With Range("A1:AQ1")
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
With .Borders(xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight,
xlInsideVerticle)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Font
.Name = "Arial"
.Size = 8
.Bold = False
.ColorIndex = xlAutomatic
End With
With .Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End With ' the outside overall with statement


******** Original code below *************
Range("A1:AQ1").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
With Selection.Font
.Name = "Arial"
.Size = 8
.Bold = False
.ColorIndex = xlAutomatic
End With
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With

Otto Moehrbach

nesting with statements
 
"Verticle" is spelled "Vertical". HTH Otto
"Arnold Klapheck" wrote in
message ...
I was trying to do the following (to get away from the select) but am
getting
a "variable not defined" and it is highlighting xlInsideVerticle, or (if
I
take out xlInsideVerticle) error msg " wrong # of variables or invalid
property assignment" and .Borders is highlighted, any
suggestions would be appreciated, thanks

With Range("A1:AQ1")
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
With .Borders(xlEdgeLeft, xlEdgeTop, xlEdgeBottom, xlEdgeRight,
xlInsideVerticle)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Font
.Name = "Arial"
.Size = 8
.Bold = False
.ColorIndex = xlAutomatic
End With
With .Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End With ' the outside overall with statement


******** Original code below *************
Range("A1:AQ1").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection
.NumberFormat = "General"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
With Selection.Font
.Name = "Arial"
.Size = 8
.Bold = False
.ColorIndex = xlAutomatic
End With
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With





All times are GMT +1. The time now is 12:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com