Results 1 to 7 of 7

How can I automatically insert this source code into new tabs or all Tabs?

Threaded View

  1. #1
    Registered User
    Join Date
    07-12-2014
    Location
    North Carolina
    MS-Off Ver
    Office 2007
    Posts
    79

    How can I automatically insert this source code into new tabs or all Tabs?

    Hello,
    Does anyone know how I can automatically create a new tab with this Private Sub as the source code OR apply this code to every tab in a workbook? I need it to be automated, I cannot ask the user to paste it into the source code of every new tab.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
     
    Dim RngRow As Range
    Dim RngCol As Range
    Dim RngFinal As Range
    Dim Row As Long
    Dim Col As Long
     
    Cells.Interior.ColorIndex = xlNone
     
    Row = Target.Row
    Col = Target.Column
     
    Set RngRow = Range("A" & Row, Target)
    Set RngCol = Range(Cells(1, Col), Target)
    Set RngFinal = Union(RngRow, RngCol)
     
    RngFinal.Interior.ColorIndex = 15
     
    End Sub
    Thanks in advance,

    Chad
    Last edited by Leith Ross; 04-29-2015 at 08:16 PM. Reason: Fixed Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA code to merge multiple sheet with multiple tabs into one workbook in different tabs
    By Jagdev in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-06-2015, 07:42 AM
  2. Copy Tabs from different excel file by using code name of the tabs
    By varun.kalra1988 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-15-2014, 02:03 PM
  3. [SOLVED] Insert tabs and put the name in tabs according to cell value
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2012, 06:52 PM
  4. Insert new rows on multiple tabs automatically
    By juliorevka in forum Excel General
    Replies: 0
    Last Post: 02-27-2012, 12:50 PM
  5. How do pivot table source fields automatically create tabs
    By Datamonkey in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-25-2006, 01:55 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