+ Reply to Thread
Results 1 to 2 of 2

Call sheet embedded sub from another sheet embedded sub

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-05-2011
    Location
    behind you!
    MS-Off Ver
    Excel 2010
    Posts
    116

    Call sheet embedded sub from another sheet embedded sub

    Hi, I trigger this code via a Command Button (ActiveX Control). CommandButton3_Click() is stored in a sheet not a module, BAML_HYSpread is stored in another sheet not a module.

    Private Sub CommandButton3_Click()
    
    Call BAML_HYSpread
    
    
    End Sub

    "Call BAML_HYSpread" gives an error: "Compile error: Sub or Function not definded"

    There is no error by storing "BAML_HYSpread" in a module.

    Does Excel not allow to call from sheet to sheet in general?

    If so, why? In my view this would be very helpful due to organizational reasons.

    Best,
    Lloyd

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Call sheet embedded sub from another sheet embedded sub

    You need to add the sheet name before the call.
    Here for demonstration

    in Sheet6' code

    Option Explicit
    Private Sub CommandButton1_Click()
        Call Sheets("Sheet7").Message1
    End Sub

    in Sheet7' code

    Option Explicit
    
    Sub Message1()
        MsgBox (" you are in Sheet7")
    End Sub
    Last edited by PCI; 09-26-2019 at 12:47 PM.
    - Battle without fear gives no glory - Just try

+ 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] Copying embedded charts from chart sheet
    By derek8 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 07-24-2013, 06:21 PM
  2. Replies: 1
    Last Post: 02-21-2013, 12:11 PM
  3. [SOLVED] How to count the number of files embedded in an XLS sheet
    By FulhamTim in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2012, 06:51 PM
  4. Nested If Embedded Funtion in Time Sheet
    By Alexis02 in forum Excel General
    Replies: 3
    Last Post: 06-14-2012, 04:07 AM
  5. Extract Pdf files embedded in an Excel Sheet
    By gururajendrak in forum Excel General
    Replies: 0
    Last Post: 07-20-2010, 03:32 AM
  6. Replies: 0
    Last Post: 05-11-2006, 12:45 PM
  7. Embedded excel sheet in outlook question???
    By Shane in forum Excel General
    Replies: 2
    Last Post: 02-06-2006, 12:35 PM
  8. [SOLVED] Embedded Chart in Excel Sheet
    By George in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-04-2005, 08:05 AM

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