+ Reply to Thread
Results 1 to 9 of 9

Calling a Private Sub from another module

  1. #1
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    398

    Calling a Private Sub from another module

    Hi,

    I have a code in module1 - Sub SortingData()
    and then code..

    And Sheet1 has - Private Sub CommandButton1_Click()
    and then code.

    I want to call Private Sub CommandButton1_Click() from my module1 - Sub SortingData()
    My English is very poor, so please be patient >_<"

    Thanks & Regards.
    hkbhansali

  2. #2
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Calling a Private Sub from another module

    Maybe like this :

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    398

    Re: Calling a Private Sub from another module

    Hi karmapala

    there is debug error while code run

  4. #4
    Forum Contributor ANDREAAS's Avatar
    Join Date
    05-06-2013
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    368

    Re: Calling a Private Sub from another module

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-21-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    398

    Re: Calling a Private Sub from another module

    Hi, ANDREAAS

    No..Not working..there is "compile error" - "Variable not Defined"

  6. #6
    Forum Contributor ANDREAAS's Avatar
    Join Date
    05-06-2013
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    368

    Re: Calling a Private Sub from another module

    sorry, don't know then. it works like that on my side.

  7. #7
    Forum Contributor ANDREAAS's Avatar
    Join Date
    05-06-2013
    Location
    Port Elizabeth, South Africa
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    368

    Re: Calling a Private Sub from another module

    Please Login or Register  to view this content.
    That should do the trick, it is because of the difference in public and private sub.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Calling a Private Sub from another module

    Should be
    Please Login or Register  to view this content.

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Calling a Private Sub from another module

    Assuming the code name of the sheet is Sheet1 then
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

+ 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. [SOLVED] Calling Private Sub from outside Userform
    By gsandy in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-01-2018, 03:57 AM
  2. [SOLVED] Calling a Module From Another Module (Error 1004)
    By js0873 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-17-2017, 12:19 PM
  3. Calling a Private SUB from SHEET
    By satanovsyn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-20-2011, 08:52 AM
  4. Calling a private sub
    By goofy78270 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2007, 02:47 PM
  5. [SOLVED] Calling a private macro
    By Nick Smith in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-08-2006, 09:20 AM
  6. Calling Private Sub/Function
    By AMK4 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2006, 09:55 PM
  7. Calling worksheet module from other module.
    By Michael Malinsky in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2005, 04:50 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