+ Reply to Thread
Results 1 to 3 of 3

worksheet_change from Module?

  1. #1
    Registered User
    Join Date
    03-31-2014
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    48

    worksheet_change from Module?

    Hi,
    I use excel as a macro template to do things in another excel (start with certain shortcut and it is running, no problem).
    The macros are saven in Module in the template excel.
    I would like to use worksheet_change also in the new excel, with data in Sheet1.
    How can I do this starting from the "template excel"? Is it possible?

    E.g. I place this code as test in my "template excel", run the routine and can use the same worksheet_change in the new excel.

    Many thanks for help

    PHP Code: 
    Public Sub worksheet_change(ByVal target As Range)

    If 
    target Cells(11Then
    Cells
    (12) = "test"
    End If

    End Sub 

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: worksheet_change from Module?

    The way I usually do that sort of thing is to have the macro in a template sheet in my original workbook.

    I can then copy the sheet to the new workbook complete with the macro.

    Can that not work for you?

    If not I will try and remember how to create a macro using vba for you.


    Please Login or Register  to view this content.
    1. You may need to Enable Applications Extensibility 5.3

    select the tools menu and "References"

    Then find "Microsoft Visual Basic for Applications Extensibility 5.3 library" and check it.
    enter image description here

    2. You may need to modify the Trust Centre settings.

    Click Application Options.
    Click the Trust Center tab, and then click
    Trust Center Settings.
    Click the Macro Settings tab, click to select the Trust access to the VBA project object model check box, and then click OK.
    Click OK.
    Last edited by mehmetcik; 01-16-2021 at 04:47 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    03-31-2014
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    48

    Re: worksheet_change from Module?

    OK, I didn't see your next post. Thanks, I will check if this could work for me. Thank you very much

    xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    I don't think it would, unless I don't understand competely what you're saying. The data in sheet1 = template will be different then data in sheet1 = another workbook, the columns will be the same,
    but not the data.
    It is possible to copy the macro code only, like it is done into excel, but only within macros? maybe something with VBAProject.xxxxx?
    I don't know really.
    Thanks for help anyway!

+ 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. Suspend Worksheet_Change while module is running
    By amidatti in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-29-2019, 12:12 PM
  2. [SOLVED] Extra Sheet not a Chart or Old Macro Module or Worksheet - Appears to be normal module???
    By Doc.AElstein in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-06-2017, 04:10 AM
  3. change the (Worksheet_Change) event for a module (Sub).
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-07-2012, 01:37 PM
  4. Pass Worksheet_Change Target to Module
    By Hammer_757 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2012, 08:34 PM
  5. Not run Worksheet_Change if values change by macro in a module
    By cgkmal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2011, 06:42 PM
  6. how to access Sheet module, normal module, Worbook module to type code
    By alibaba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2009, 07:51 AM
  7. Call Worksheet_Change from diff module
    By MCCCLXXXV in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-10-2008, 01:44 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