Results 1 to 5 of 5

Thread: Calling another macro in same workbook

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member
    Join Date
    Aug 2011
    Posts
    92
    Rep Power
    14

    Calling another macro in same workbook

    Hi I have two following macros in one wrokbook:

    1- FormatSheet
    2- DeleteData

    I wants to trigger DeleteData macro while running FormatSheet macro when in Sheet2 J4 cell value is 0. So it woukd be somthing like this:

    run DeleteData if Sheet 2 cell value =0 , if not continue with FormatSheet macro


    Thanks
    Rajesh

  2. #2
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    14
    Quote Originally Posted by Rajesh Kr Joshi View Post
    Hi I have two following macros in one wrokbook:

    1- FormatSheet
    2- DeleteData

    I wants to trigger DeleteData macro while running FormatSheet macro when in Sheet2 J4 cell value is 0. So it woukd be somthing like this:

    run DeleteData if Sheet 2 cell value =0 , if not continue with FormatSheet macro
    It would probably help if we could see your FormatSheet macro (probably seeing the DeleteData macro would be helpful as well) and indicate where in the FormatSheet macro you think you want to run the DeleteData macro at. Posting a copy of your workbook with the macro installed in it would be even better.

  3. #3
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    I second Rick on that one. Keeps any assumptions out of the window, thus increasing the chances of a more accurate solution.

    From what I gather, is this what you are looking for

    Code:
    If Worksheets("Sheet2").Range("J4").Value = 0 Then
    Call DeleteData
    End If

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 07-07-2023 at 01:07 PM.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  4. #4
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    14
    Quote Originally Posted by Excel Fox View Post
    From what I gather, is this what you are looking for

    Code:
    If Worksheets("Sheet2").Range("J4").Value = 0 Then
    Call DeleteData
    End If
    The reason I hesitated in giving the OP an answer is I'm kind of sensing there is a loop iterating in FormatSheet and I wasn't sure if the If..Then you showed should be wrapped around the loop or embedded within it, hence my desire for more information.

  5. #5
    Member
    Join Date
    Aug 2011
    Posts
    92
    Rep Power
    14
    Thanks Rick and Admin

    This code helped.


    Thanks
    Rajesh

Similar Threads

  1. Replies: 4
    Last Post: 07-02-2013, 11:32 AM
  2. Open And Activate Workbook Before Runing Macro
    By Howardc in forum Excel Help
    Replies: 5
    Last Post: 06-04-2013, 07:23 PM
  3. Replies: 0
    Last Post: 04-20-2013, 10:07 AM
  4. How To Save Macro To Personal Workbook
    By NITIN SHETTY in forum Excel Help
    Replies: 1
    Last Post: 04-07-2013, 01:07 PM
  5. Selecting workbook to run macro
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 2
    Last Post: 08-24-2012, 08:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •