+ Reply to Thread
Results 1 to 14 of 14

Problem in customizing ribbon

  1. #1
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Problem in customizing ribbon

    Hello

    I have a commandbutton on my sheet11.I have have created an icon on my custom ribbon and want the code of that commandbutton run if i click on the icon on my new ribbon tab. How can I?

    Best Regards
    Imran Bhatti
    Teach me Excel VBA

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Problem in customizing ribbon

    In customize ribbon, top left dropdown defaults to Popular Commands, change to macros then select the required macro from there

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Problem in customizing ribbon

    the code resides in the click event of the commandbutton1 and this button is placed on sheet.

    Like
    Private sub CommandButton1_Click()
    Code here
    End sub
    YOur mentioned dropdown shows only macros which are in a modual and not the click events of forms controls

  4. #4
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Problem in customizing ribbon

    So does your code require the user to complete something and then click the command button e.g show a userform first? Or can you just duplicate the code into module and select the macro from there?

  5. #5
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Problem in customizing ribbon

    Lemme do it

  6. #6
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Problem in customizing ribbon

    by creating a duplicate an error occurs
    " Object Required"

    and this line of code gets highlighted
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: Problem in customizing ribbon

    So you need to assign a macro to show your form which contains DTPicker.

  8. #8
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Problem in customizing ribbon

    Sorry for providing less information. Here are the complete info

    the code in the click event of commandbutton1 (which is on sheet and not in a userform) and this code goes to a journal determines the rows whether the column of the journal contains the dates equal to or in between the dates of dtpicker1 and dtpicker2 then it determines wheter the column 5 of journal contains a account head that is in L2 cell after determining these 3 criterias this code copies all the rows(meeting criteria) from the journal and pastes to another location as a ledger.
    I want to keep both this command button and a button on the ribbon .Both should perform the above mentioned task.

    Hope now it is all conveyed

    Best Regards
    Imran Bhatti

  9. #9
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem in customizing ribbon

    You will need to post the code for the click event, I feel.

    Alternatively, you might create a macro in a normal module thus
    Please Login or Register  to view this content.
    and assign this macro to your ribbon button. Sheet1 needs to be replaced with the code name- not the tab name- of the sheet with the button.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  10. #10
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Problem in customizing ribbon

    Here is the code
    Please Login or Register  to view this content.

  11. #11
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem in customizing ribbon

    Which sheet is that code in?

  12. #12
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Problem in customizing ribbon

    commandbutton is placed in sheet11 . the journal and ledger are also on the same sheets

  13. #13
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem in customizing ribbon

    Try this code in a normal module and call this routine from the button click and your menu item
    Please Login or Register  to view this content.

  14. #14
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: Problem in customizing ribbon

    Hi xlnitwit it worked perfectly.but I found another problem with custom ribbon. But I am gona mark this thread and please and post a new thread for the next problem in line with this problem."After changing the location of the file or renaming it the Custom ribbon buttons don't work at all".

+ 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. Customizing the ribbon in 2010(vs 2007)
    By Bishonen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-15-2013, 03:29 AM
  2. Customizing a ribbon with macros
    By DrNerj in forum Excel General
    Replies: 0
    Last Post: 08-15-2012, 10:15 AM
  3. Customizing ribbon with buttons for macros
    By DrNerj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-15-2012, 09:28 AM
  4. [SOLVED] Customizing Ribbon in Word 2010
    By kapucino in forum Word Formatting & General
    Replies: 4
    Last Post: 05-15-2012, 07:54 AM
  5. Customizing Ribbon Keytips
    By a2olmo in forum Excel General
    Replies: 4
    Last Post: 05-06-2010, 09:58 PM
  6. Excel 2007 : Customizing the ribbon/menu items.
    By LAF in forum Excel General
    Replies: 2
    Last Post: 07-29-2008, 12:37 PM
  7. Replies: 1
    Last Post: 06-11-2008, 11:23 PM

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