+ Reply to Thread
Results 1 to 5 of 5

Macro doesn't work but recording it does.

  1. #1
    Rob
    Guest

    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. #2
    bj
    Guest

    RE: Macro doesn't work but recording it does.

    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. #3
    Rob
    Guest

    Re: Macro doesn't work but recording it does.

    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" <[email protected]> wrote in message
    news:[email protected]...
    >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
    >>
    >>
    >>
    >>




  4. #4
    Rob
    Guest

    Re: Macro doesn't work but recording it does.

    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" <[email protected]> wrote in message
    news:[email protected]...
    >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
    >>
    >>
    >>
    >>




  5. #5
    Rob
    Guest

    Re: Macro doesn't work but recording it does.

    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" <[email protected]> wrote in message
    news:[email protected]...
    >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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1