+ Reply to Thread
Results 1 to 12 of 12

Excel 2010 VBA - Next and Previous Buttons

  1. #1
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Excel 2010 VBA - Next and Previous Buttons

    I have a three page Multi-Page Userform. Off the the Multi-Page, but within the UserForm are Next and Previous buttons coded as follows:

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    Neither of them are working. Any ideas? Thank you in advance for your help!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    What are the next/previous buttons and the multipage called?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: Excel 2010 VBA - Next and Previous Buttons

    ButtonNext and ButtonPrevious

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    The code should work then.

    Try adding breakpoints (F9) to both subs.

    Then run the userform and try the buttons.

    What happens?

  5. #5
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: Excel 2010 VBA - Next and Previous Buttons

    That is new to me. Where should my curse be when I hit F9?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    On the first line of code or even the sub header itself.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel 2010 VBA - Next and Previous Buttons

    In the file you attached in a previous thread the multipage was called MultiPage1 and IntvwWorksheet was the name of the userform.

  8. #8
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: Excel 2010 VBA - Next and Previous Buttons

    Oh, you are right. The multi-page is called MultiPage1. However, the Next, Previous, Done and Print buttons are off of the multi-page and on the IntvwWorksheet.

    What is a break point and what does it do? When I press F9 on the line that says 'Private Sub ButtonNext_Click ()' I get a red line with a red circle at the beginning. If I press F9 on the line for 'Dim i As Long' I get a message saying 'Breakpoint not allowed on this line'

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel 2010 VBA - Next and Previous Buttons

    Setting a break point will make code execution break on the line of code they are on.

    It's a useful way to halt things so you can see what's happening, eg what value variables have

    Also if you know where an error occurs you can set a breakpoint before that point and then step through
    the code up to where the error happens and see what's going on.

    You can't set a breakpoint on everything, and that includes declarations.

    Back to the code.

    When I run it as is I get the error Method or property not found and one of the lines with IntvwWorksheet.Value is highlighted.

    If I change IntvwWorksheet to Multipage1 there are no errors and the code works.

  10. #10
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: Excel 2010 VBA - Next and Previous Buttons

    Hmmm, when I make that change, the previous button works fine, but the Next button doesn't. I get no code, it just closes down my userform.

  11. #11
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: Excel 2010 VBA - Next and Previous Buttons

    Never mind - I had to get rid of that breakpoint.

    Thank you for your help once again!!!

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Excel 2010 VBA - Next and Previous Buttons

    Aye, you need to mind and clear the breakpoints when you're finished with them.

    Forget to do that myself all the time.

+ 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