1004 Error: Unable to set the LineStyle property of the Border class

S

Satish

Hi,

I am running excel 2007 on XP-SP2. I am facing a 1004 error: "Unable
to set the LineStyle property of the Border class" at this line
- .Borders(xlDiagonalDown).LineStyle = xlNone

Here is the code snippet:
Sub Generate_Internal_Effort()
'get number of rows
With Worksheets(3)
last_row = .Range(.Cells(3, 2), .Cells(3, 2).End
(xlDown)).Rows.Count
End With

'copy existing rows elsewhere
rnge = "A3:" & "L" & last_row + 2
Range(rnge).Copy Destination:=Worksheets(3).Range("A10000")

Worksheets(3).Range(rnge).Select
' Selection.ClearContents

With Selection
'Remove cell colors
.Interior.ColorIndex = xlNone

'Remove all cell borders
.Borders(xlDiagonalDown).LineStyle = xlNone 'FACING ERROR
HERE!!
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlEdgeLeft).LineStyle = xlNone
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
.Borders(xlEdgeRight).LineStyle = xlNone
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone

'Remove all special font properties and formatting
With .Font
.FontStyle = "Regular"
.Strikethrough = False
.Superscript = False
.Subscript = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End With

<<Further code exists>>

End Sub

The above code is in a module. And this code is invoked thru a form
control button on Sheet3. Can anyone tell me whats going wrong here.

Thanks!
Satish
 
S

Satish

Hi,

I am running excel 2007 on XP-SP2. I am facing a 1004 error: "Unable
to set the LineStyle property of the Border class" at this line
-         .Borders(xlDiagonalDown).LineStyle = xlNone

Here is the code snippet:
Sub Generate_Internal_Effort()
'get number of rows
    With Worksheets(3)
        last_row = .Range(.Cells(3, 2), .Cells(3, 2).End
(xlDown)).Rows.Count
    End With

'copy existing rows elsewhere
    rnge = "A3:" & "L" & last_row + 2
    Range(rnge).Copy Destination:=Worksheets(3).Range("A10000")

    Worksheets(3).Range(rnge).Select
'    Selection.ClearContents

    With Selection
         'Remove cell colors
        .Interior.ColorIndex = xlNone

         'Remove all cell borders
        .Borders(xlDiagonalDown).LineStyle = xlNone    'FACING ERROR
HERE!!
        .Borders(xlDiagonalUp).LineStyle = xlNone
        .Borders(xlEdgeLeft).LineStyle = xlNone
        .Borders(xlEdgeTop).LineStyle = xlNone
        .Borders(xlEdgeBottom).LineStyle = xlNone
        .Borders(xlEdgeRight).LineStyle = xlNone
        .Borders(xlInsideVertical).LineStyle = xlNone
        .Borders(xlInsideHorizontal).LineStyle = xlNone

         'Remove all special font properties and formatting
        With .Font
            .FontStyle = "Regular"
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = xlAutomatic
        End With
    End With

<<Further code exists>>

End Sub

The above code is in a module. And this code is invoked thru a form
control button on Sheet3.  Can anyone tell me whats going wrong here.

Thanks!
Satish

Hi All!

Sorry to bother, but any clues on this one?

thanks
Satish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top