Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Rob
 
Posts: n/a
Default Macro doesn't work but recording it does.

Hi all,
I've recorded the following macro and as it's recording the pagebreak is
deleted without a problem.

Private Sub CommandButton1_Click()
Range("F143").Select
ActiveSheet.HPageBreaks(1).Delete
End Sub

If I try to run the macro (making sure all the conditions are the same. ie
the page break is there), I get the error message "Application - Defined or
Object - Defined Error.

Anyone know why this would happen. (I'm using Office 2000.)

Rob



  #2   Report Post  
bj
 
Posts: n/a
Default

I don't know why it won't work.
Which line gets the error message in debug

"Rob" wrote:

Hi all,
I've recorded the following macro and as it's recording the pagebreak is
deleted without a problem.

Private Sub CommandButton1_Click()
Range("F143").Select
ActiveSheet.HPageBreaks(1).Delete
End Sub

If I try to run the macro (making sure all the conditions are the same. ie
the page break is there), I get the error message "Application - Defined or
Object - Defined Error.

Anyone know why this would happen. (I'm using Office 2000.)

Rob




  #3   Report Post  
Rob
 
Posts: n/a
Default

Hi bj,

I missed your reply earlier but came across it just now. I don't have the
problem now. It corrected itself somehow. Must have been a hiccup???

Rob

"bj" wrote in message
...
I don't know why it won't work.
Which line gets the error message in debug

"Rob" wrote:

Hi all,
I've recorded the following macro and as it's recording the pagebreak is
deleted without a problem.

Private Sub CommandButton1_Click()
Range("F143").Select
ActiveSheet.HPageBreaks(1).Delete
End Sub

If I try to run the macro (making sure all the conditions are the same.
ie
the page break is there), I get the error message "Application - Defined
or
Object - Defined Error.

Anyone know why this would happen. (I'm using Office 2000.)

Rob






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recording a macro ... Marss Excel Discussion (Misc queries) 3 February 17th 05 07:26 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
How do I record a macro which should work on multiple files ? Venkataraman.P.E Excel Discussion (Misc queries) 2 January 16th 05 10:26 AM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 3 December 13th 04 08:43 PM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 1 December 13th 04 07:55 PM


All times are GMT +1. The time now is 07:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"