PC Review


Reply
Thread Tools Rate Thread

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

 
 
Satish
Guest
Posts: n/a
 
      24th Aug 2009
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
 
Reply With Quote
 
 
 
 
Satish
Guest
Posts: n/a
 
      27th Aug 2009
On Aug 24, 5:23*pm, Satish <k.sati...@gmail.com> 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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Unable to set the LineStyle property of the border class" NoSpam@aol.com Microsoft Excel Programming 4 4th Jun 2010 11:22 PM
Error 1004 - unable to set the hastitle property of the axis class =?Utf-8?B?SGVucmk=?= Microsoft Excel Programming 14 18th Nov 2007 04:21 PM
Error LineStyle property of Border Class =?Utf-8?B?TmV2aWxsZVQ=?= Microsoft Excel Programming 2 1st Nov 2007 11:28 AM
Unable to set the Name Property of the Series Class : Error '1004' =?Utf-8?B?RnJhbmNvaXM=?= Microsoft Excel Charting 1 21st May 2004 02:35 AM
Run time error 1004 - Unable to get add property of the buttons class Mark Microsoft Excel Programming 0 1st Mar 2004 09:48 AM


Features
 

Advertising
 

Newsgroups
 


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