Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
xlNone incorrectly valued?
This seems very odd.
The following code works fine as long as the choice from the input box is 1 (thin) or 2 (thick). If it is, xlNone is valued properly at 2 and 4 respectively. However,If it's 0 (none) then ib1 gets valued to -4142 and I get run time error 1004 Unable to set Weight property of Border class. Any help greatfully appreciated. Sub Brdrs() ib1 = InputBox("None (0), Thin (1), or Thick (2): ", "INNER Border Style", 1) If ib1 = 0 Then ib1 = xlNone ElseIf ib1 = 1 Then ib1 = xlThin ElseIf ib1 = 2 Then ib1 = xlThick Else ib1 = xlThin End If With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = ib1 .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = ib1 .ColorIndex = xlAutomatic End With End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
xlNone incorrectly valued?
If I am not mistaken, you apply "xlThin" to the "LineStyle" of the Border as
you have. See small demo below. To make it "None", you apply xlNone to the LineStyle itself, not the Weight property. With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic 'etc... End With Selection.Borders(xlEdgeTop).LineStyle = xlNone HTH :) Dana DeLouis "BruceD" wrote in message ... This seems very odd. The following code works fine as long as the choice from the input box is 1 (thin) or 2 (thick). If it is, xlNone is valued properly at 2 and 4 respectively. However,If it's 0 (none) then ib1 gets valued to -4142 and I get run time error 1004 Unable to set Weight property of Border class. Any help greatfully appreciated. Sub Brdrs() ib1 = InputBox("None (0), Thin (1), or Thick (2): ", "INNER Border Style", 1) If ib1 = 0 Then ib1 = xlNone ElseIf ib1 = 1 Then ib1 = xlThin ElseIf ib1 = 2 Then ib1 = xlThick Else ib1 = xlThin End If With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = ib1 .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = ib1 .ColorIndex = xlAutomatic End With End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
File is in use by <valued customer... read only... etc... | Excel Discussion (Misc queries) | |||
Look up valued based on two values | Excel Worksheet Functions | |||
MICROSOFT VALUED PROFESSIONAL | Excel Discussion (Misc queries) | |||
Conditionally formatting highest valued cell? | Excel Worksheet Functions | |||
How do I subtract with text valued number instead of an actual num | Excel Worksheet Functions |