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
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
In customize ribbon, top left dropdown defaults to Popular Commands, change to macros then select the required macro from there
the code resides in the click event of the commandbutton1 and this button is placed on sheet.
Like
YOur mentioned dropdown shows only macros which are in a modual and not the click events of forms controlsPrivate sub CommandButton1_Click()
Code here
End sub
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?
Lemme do it
by creating a duplicate an error occurs
" Object Required"
and this line of code gets highlighted
Please Login or Register to view this content.
So you need to assign a macro to show your form which contains DTPicker.
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
You will need to post the code for the click event, I feel.
Alternatively, you might create a macro in a normal module thus
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.Please Login or Register to view this content.
Don
Please remember to mark your thread 'Solved' when appropriate.
Here is the code
Please Login or Register to view this content.
Which sheet is that code in?
commandbutton is placed in sheet11 . the journal and ledger are also on the same sheets
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.
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".
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks