+ Reply to Thread
Results 1 to 2 of 2

Macro (Module) to copy macro (sheet) to a sheet

Hybrid View

tuneloon Macro (Module) to copy macro... 08-30-2013, 04:20 PM
Norie Re: Macro (Module) to copy... 08-30-2013, 04:57 PM
  1. #1
    Registered User
    Join Date
    09-23-2008
    Location
    Kansas
    Posts
    32

    Macro (Module) to copy macro (sheet) to a sheet

    I have a long macro set up which creates multiple sheets with various data which works great.

    I would like to add the following code

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Cells.Interior.Pattern = xlNone
    Rows(Target.Row).Interior.Color = 15773696
    End Sub
    to each of the individual sheets at the end of the macro, so that when the person doing the research is adding specific data they can easily tell which line they are on.

    Each of the sheets are added and renamed in the macro

    Sheets.Add After:=Sheets(Sheets.Count)
        Sheets("Sheet3").Select
        Sheets("Sheet3").Name = "Discount"
    I can't figure out how to code the module to add the code to each sheet.


    Any suggestions?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Macro (Module) to copy macro (sheet) to a sheet

    Use the workbook level event SheetSelectionChange.
    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    
    End Sub
    If posting code please use code tags, see here.

+ 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] Macro to Copy Data from one Sheet A to Sheet B based on value in cell on sheet A
    By scass in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2012, 07:21 PM
  2. How to copy sheet to new book without sheet module code?
    By MelinaT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2011, 11:52 AM
  3. Macro/Module running as background process, copy data from sheet to sheet
    By ctor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2009, 05:48 AM
  4. Assigning Macro/Module to specific sheet
    By JOGIER in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-28-2009, 03:35 PM
  5. accessing array of an userform from a Sheet/module macro code
    By stanigator in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2007, 09:34 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