ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   1004 Error: Unable to set the LineStyle property of the Border class (https://www.excelbanter.com/excel-programming/432778-1004-error-unable-set-linestyle-property-border-class.html)

Satish

1004 Error: Unable to set the LineStyle property of the Border class
 
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

Satish

1004 Error: Unable to set the LineStyle property of the Borderclass
 
On Aug 24, 5:23*pm, Satish wrote:
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


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

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