+ Reply to Thread
Results 1 to 34 of 34

Calling naother macro in Sub Procedure failed

  1. #1
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Calling naother macro in Sub Procedure failed

    Hi,

    I have written the code in VBA wherein it will update values on User excel sheet automatically when button is clicked. This macro runs fine when I assign it to individual button and run it but when I call this macro in another sub procedure , then I t does not work finely.

    Please give me the solution for this now.

    Please Login or Register  to view this content.
    When I assign Run macro to a button , then it does not work . Also Run macro has other 55 lines of the code in it . I want to assign this run macro to a button and run both macros viz Run and MAin12 one by one.

    Rquest your help









    Regards,
    Chetan Chavan
    Last edited by AliGW; 11-01-2020 at 03:32 AM.

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Calling naother macro in Sub Procedure failed

    You should write macro with parenthesis:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    all macros have been written with parenthesis here only.

  4. #4
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    please help me troubleshoot this code now

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,434

    Re: Calling naother macro in Sub Procedure failed

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. As you are still new here, I will do it for you this time.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    I am new to this forum , please do required changes now. thanks . and also answer my question as it will help me a lot now.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,434

    Re: Calling naother macro in Sub Procedure failed

    I have already made the changes, as you can see just by looking at your opening post. I am not able to answer your question - you will need to wait PATIENTLY for someone who can.

    Please update your Excel version in your forum profile - 501 is not a recognised version.

  8. #8
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Calling naother macro in Sub Procedure failed

    Can you share the workbook where you are trying to assign the macro to a button, as per the yellow banner above.

  9. #9
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Calling naother macro in Sub Procedure failed

    Not holding out much hope, but does this work for you

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Hi Bob,

    I have assigned main 12 macro to a command button on excel sheet and another main macro named button click is calling this macro main 12 .

    It is not working



    Best Regards,
    Chetan Chavan

  11. #11
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: Calling naother macro in Sub Procedure failed

    What exactly does "not working" mean?
    Rory

  12. #12
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35
    Quote Originally Posted by rorya View Post
    What exactly does "not working" mean?
    Dear Sir,

    I am calling macro named Main 12 in another macro named button_ Click and I have this button_ click macro to one button on Excel Sheet now.

    Whenever I clicking this button on excel sheet both macros should get executed here .

    But macro named Main 12 is not getting called and it's code did not get executed at all.
    Main 12 macro puts some values from sheet 1 to another sheet to tell you exactly main 12 macro copies some values and put it on another sheet here.

    Plz help me in this now









    Thanks.

  13. #13
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Plz help me resolve this as I ma not able to troubleshoot this now.

  14. #14
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Another point I wanted to tell you here is this second macro named Main 12 gets executed when it is assigned independently to another button on excel sheet. But what I wanted is execute two macros one by one by clicking only one button here.

  15. #15
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    In above code which I have shared earlier , I have used the name Run for Button_ click macro here. So please do not get confused here.

  16. #16
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Hi request the reply from esteemed members now

  17. #17
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Hi,

    Please reply to my question urgently as I am stuck completely now.

    Regards,
    Chetan Chavan

  18. #18
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Hi,

    I am waiting for a long time to get the reply on this.

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,434

    Re: Calling naother macro in Sub Procedure failed

    Not really - it's only been 14 minutes since you last posted!

    We don't do 'urgent' here - any help you get is discretionary and completely free of charge, so members will step in only if they feel they can and have time to do so.

    You have NOT updated your profile, as I requested in post #7, and you have not provided a workbook with the problem macro, so there is very little to go on. This is probably why you have not yet had a solution. We are not crystal ball gazers.

  20. #20
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    ok,
    But I have posted original message quite long time ago so need help if possible, there is no compulsion here.

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,434

    Re: Calling naother macro in Sub Procedure failed

    Yes, indeed, and three people have tried to help. Now I am asking you to provide more information, as they clearly can't help you as it stands. If you are unwilling to do so, then you can expect there to be no further offers of help. The ball is in your court: just repeating that you need help is not enough.

  22. #22
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Calling naother macro in Sub Procedure failed

    As you mentioned there is other content in Run macro
    Quote Originally Posted by chetanhm View Post
    ... Also Run macro has other 55 lines of the code in it . I want to assign this run macro to a button and run both macros viz Run and MAin12 one by one.
    ...
    Then there is a chance that one of this 55 lines terminates further execution of macro with something like
    Please Login or Register  to view this content.
    etc.

    So my proposition is:

    Please Login or Register  to view this content.

    and assign CallBothRunAndMain12 to the button.

    BTW. posting whole code of Run, not to mention the attachment with a file would shorten this thread to probably some 2-5 posts. It's just wasting the time of people who volunteer to help
    Best Regards,

    Kaper

  23. #23
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Sir,

    I did as per your suggestion but stil it is not working . When I assign same macro named Main12 to another button, then it works fine, when both macros are combined into one macro or sub procedure , it does not work . is it due to long lines of code in first macro named Run ?
    is there any limitation on no of lines it can execute?

    Please help me in this .

  24. #24
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Calling naother macro in Sub Procedure failed

    See this part of my previous answer
    Quote Originally Posted by Kaper View Post
    ... posting whole code of Run, not to mention the attachment with a file would shorten this thread to probably some 2-5 posts. It's just wasting the time of people who volunteer to help

  25. #25
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    ok, let me know what details you will need now to help me troubleshoot this??

  26. #26
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Calling naother macro in Sub Procedure failed

    See yellow box at the top of page.

  27. #27
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Sir, issue is code has confidential data in it, so could not share it with you. please advice

  28. #28
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Calling naother macro in Sub Procedure failed

    Have you really tried the below? If Run and Main12 work if called separately (in that sequence) they shall in 99.9999% work also when called by CallBothRunAndMain12
    Quote Originally Posted by Kaper View Post

    Please Login or Register  to view this content.

    and assign CallBothRunAndMain12 to the button.
    and it's you who need the solution. So some work could replace confidential data with dummy data. It was my last advice if you don't have a will to collaborate. Bye!

  29. #29
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,434

    Re: Calling naother macro in Sub Procedure failed

    How can you expect to get help when you refuse to cooperate?

    1. I have asked you TWICE to update your forum profile. 501 is NOT a valid Excel version - please change this to show what you are using.
    2. You have been asked for a SAMPLE workbook with DESENSITISED data - this requires a bit of effort on your part, but needs to be done.

  30. #30
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    Hi,

    I tried to troubleshoot this issue and found that div/0 error occurs as I am copying cell which has equal to as formula. When I am pasting this in other cell through vba, it does not work but when I just copy cell which has raw value of say 456 and no formula then it works fine
    how to resolve this ?

  31. #31
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,434

    Re: Calling naother macro in Sub Procedure failed

    1. Update your profile as requested.
    2. Provide a sample workbook as requested.

  32. #32
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    I can not provide sample workbook as it is copyright information here.

    Regards,
    Chetan Chavan

  33. #33
    Registered User
    Join Date
    10-17-2020
    Location
    Pune
    MS-Off Ver
    501
    Posts
    35

    Re: Calling naother macro in Sub Procedure failed

    I will update my profile for sure.

  34. #34
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Calling naother macro in Sub Procedure failed

    SAMPLE does not mean real.

    If you do not want spend your (precious) time preparing sample worbook with dummy data just don't use our time but hire a consultant and sign the NDA with him/her.

    Bye!

+ 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. Calling Procedure or Function inside another Procedure - variables problem
    By Rudo123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2015, 03:12 PM
  2. [SOLVED] calling a procedure
    By grkchakri in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-20-2013, 09:25 PM
  3. [SOLVED] Problem with calling another macro (Error 450 and " Expected variable or procedure")
    By Roxner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-07-2013, 04:59 AM
  4. Replies: 0
    Last Post: 10-02-2012, 03:06 PM
  5. Name of calling procedure
    By ajaykgarg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2011, 04:02 PM
  6. [SOLVED] calling procedure
    By Juggernath in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-13-2005, 08:45 AM
  7. [SOLVED] Calling sub procedure
    By Yossi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2005, 09:05 AM

Tags for this Thread

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