+ Reply to Thread
Results 1 to 3 of 3

Enabling Command Button

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Enabling Command Button

    Hi Everyone,

    I am working on an application in which I use a multipage userform that has 5 pages. I have 4 command buttons titled BACK, NEXT, SAVE and CANCEL

    CANCEL button is always enable irrespective of the page number that is active in the multipage userform.
    BACK get enabled if the page no is not the first page
    SAVE gets enabled if the page number is the last page instead of enabling the NEXT button
    NEXT button gets enabled if the page number is not the last page

    All the buttons other than the NEXT button function as desired. I am facing a problem with the enabling of the NEXT Page, which I try to explain below.

    There are approx two mandatory fields on each page that need to be filled. When both these fields are filled, the NEXT button should get enabled. This works fine when a blank form is being filled. The problem arises when I use the BACK button to return to the previous page that was filled earlier, the NEXT button should be enabled immediately since both the mandatory fields are already filled out. The code I am using for enabling / disabling the button is given below

    Please Login or Register  to view this content.
    while trying to rectify this bug, I observed that I have inserted the code in the "change" instance. This means that the code will be executed only if there is a change in the field. But I am not clear under which other instance I should insert the code so that it runs as intended.

    Can someone help me with a solution to my problem ?

    Thanks in advance for the efforts that you will all be putting in to help me.

    Regards

    Anand Hattangady
    Last edited by anandvh; 03-03-2017 at 12:10 PM.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Enabling Command Button

    You add the line

    Please Login or Register  to view this content.
    to the Multipage Change event.

    Although you might have to write an If ... ElseIf... End If to make sure that the Multipage Change is checking the correct controls for that page.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Re: Enabling Command Button

    thanks mikerickson'

    Just implemented your suggestion of adding the call in the multipage change event. The NEXT button is behaving just as intended.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Enabling Reset Button
    By metabee in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-16-2017, 07:31 PM
  2. Replies: 2
    Last Post: 02-02-2016, 10:27 PM
  3. Insert Command Button that will Activate Command Button on a Different Sheet
    By realvirtuality1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2016, 02:11 PM
  4. VBA code to create command button. Print all sheets then delete command button.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2015, 05:18 PM
  5. Replies: 1
    Last Post: 09-17-2007, 09:57 PM
  6. [SOLVED] command button:Can i use a command button to open diffrrent sheets
    By Hellboy in forum Excel General
    Replies: 0
    Last Post: 11-03-2005, 11:00 AM
  7. [SOLVED] Enabling more than one option button
    By Tempy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2005, 10:06 AM

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