+ Reply to Thread
Results 1 to 3 of 3

Call macro in another sub procedure

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

    Call macro in another sub procedure

    Hi,

    I am calling macor named Main12 in another sub procedure called as Button_click. and I have assigned button_click macro to on ecommand button. When I click this button only code in button_click macro gets exceuted but not main 12 macro.
    what all changes I need to do to make it work now.
    Here is the code :



    Sub Button_Click()



    Application.EnableEvents = False
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual





    Application.wait (Now() + TimeValue("00:00:00"))

    Call Main12


    End If


    End Sub



    Sub Main12()

    Dim target As Worksheet

    Application.ScreenUpdating = False
    Application.EnableEvents = False
    Worksheets("INPUTOUTPUT").Range("N10") = 0


    Application.ScreenUpdating = False
    Application.EnableEvents = False

    Set target = Worksheets("5S-C")

    With Worksheets("INPUTOUTPUT")


    If .Range("C7").Value = "5Stage" And .Range("C9").Value = "YES" Then

    '.Select
    Range("V72:V75").Copy
    'Sheets("5S-C").Select
    'target.Range("F33:F36").PasteSpecial Paste:=xlPasteValues

    '.Select
    'Range("V73").Copy
    'Sheets("5S-C").Select
    'Range("G33").PasteSpecial Paste:=xlPasteValues

    '.Select
    'Range("V74").Copy
    'Sheets("5S-C").Select
    'Range("H33").PasteSpecial Paste:=xlPasteValues

    '.Select
    'Range("V75").Copy
    'Sheets("5S-C").Select
    'Range("I33").PasteSpecial Paste:=xlPasteValues


    target.Range("O30").Value = .Range("W87").Value
    target.Range("P30").Value = .Range("W88").Value
    target.Range("Q30").Value = .Range("W89").Value
    target.Range("R30").Value = .Range("W90").Value
    target.Range("S30").Value = .Range("W91").Value

    End If

    End With

    Application.ScreenUpdating = True
    Application.EnableEvents = True



    End Sub

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,151

    Re: Call macro in another sub procedure

    The code constructed in this way doesn't work at all.
    Attached Images Attached Images

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

    Re: Call macro in another sub procedure

    Sir, I have removed that end if error already, but still it is not working . only issue, main12 macro is not getting called in another subprocedure, whenever I call that macro from dedicated button by assigning main12 macro to it, it works fine, but when called from button_click macro, it does not work it should ie it is not called getting called from tha side

+ 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. Urgent help needed please on an xls macro - Invalid procedure call or Argument
    By fa355115 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-09-2018, 06:32 AM
  2. Macro to copy a block of data and call a sub-procedure
    By kent97 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-05-2017, 12:56 AM
  3. [SOLVED] Macro to copy column of data and call a sub-procedure
    By kent97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2017, 10:49 PM
  4. [SOLVED] Create a time delay at end of procedure that will then call on next procedure
    By Clay Shooter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-31-2013, 05:56 AM
  5. Macro Run Time error - Invalid procedure call or argument
    By clundeen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-01-2011, 01:59 AM
  6. Macro Error - Invalid Procedure Call or Argument
    By mcordi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-12-2011, 05:40 PM
  7. [SOLVED] Call Oracle Procedure from Excel macro
    By test in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2005, 10:05 PM

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