PC Review


Reply
Thread Tools Rate Thread

Clear borders macro not working in Excel 2007 but works fine in 20

 
 
RyanH
Guest
Posts: n/a
 
      9th Jun 2008
For some reason when I run this macro in Excel 2003 it works just fine. But
when I try to run it in Excel 2007 I get an Error indicated below. Anyone
have any ideas why?

Sub ClearRange ()

'clears all borders
With Range("B" & ActiveCell.Row, "H" & ActiveCell.Row + 30)
Error => .Borders(xlDiagonalDown).LineStyle = xlNone
.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
End With

End Sub
 
Reply With Quote
 
 
 
 
Jim Rech
Guest
Posts: n/a
 
      9th Jun 2008
Works here. Worksheet isn't protected, etc.?

--
Jim
"RyanH" <(E-Mail Removed)> wrote in message
news:4C2061DF-1138-4105-8F72-(E-Mail Removed)...
| For some reason when I run this macro in Excel 2003 it works just fine.
But
| when I try to run it in Excel 2007 I get an Error indicated below. Anyone
| have any ideas why?
|
| Sub ClearRange ()
|
| 'clears all borders
| With Range("B" & ActiveCell.Row, "H" & ActiveCell.Row + 30)
| Error => .Borders(xlDiagonalDown).LineStyle = xlNone
| .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
| End With
|
| End Sub


 
Reply With Quote
 
Bernard Liengme
Guest
Posts: n/a
 
      9th Jun 2008
Your macro worked just fine for me.
Try it with a new workbook
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"RyanH" <(E-Mail Removed)> wrote in message
news:4C2061DF-1138-4105-8F72-(E-Mail Removed)...
> For some reason when I run this macro in Excel 2003 it works just fine.
> But
> when I try to run it in Excel 2007 I get an Error indicated below. Anyone
> have any ideas why?
>
> Sub ClearRange ()
>
> 'clears all borders
> With Range("B" & ActiveCell.Row, "H" & ActiveCell.Row + 30)
> Error => .Borders(xlDiagonalDown).LineStyle = xlNone
> .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
> End With
>
> End Sub



 
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
Baffled, can record macro, and then RTE5. Macro works fine on another PC. Excel2007 boyd98 Webmaster / Programming 2 27th Sep 2011 05:53 PM
Code Works Fine in Excel 2007, Excel 2000 generates Runtime Error 438 Safari Microsoft Excel Programming 0 25th Jun 2009 03:53 PM
Macro - Clear Borders =?Utf-8?B?RmluYW5jZSBHdXJ1?= Microsoft Excel Programming 7 22nd Nov 2007 08:32 AM
xls file works fine in Excel 2000 and 2007 but crashes on opening in 2003 gromit12 Microsoft Excel Misc 2 6th Nov 2007 09:30 PM
XValues series breaks on disjoint ranges - but works fine in Excel 2007 laneer@gmail.com Microsoft Excel Programming 5 2nd Oct 2007 12:02 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:27 PM.