+ Reply to Thread
Results 1 to 2 of 2

How to join these (specific) two sub routines (local to sheet)?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-10-2011
    Location
    New York, NY
    MS-Off Ver
    MS Office: Excel 365
    Posts
    163

    How to join these (specific) two sub routines (local to sheet)?

    Hi --

    I'm trying to run 2 codes that run on a specific sheet.

    Each one runs on their own, but whenever I to have both of them, i get an error.
    (Code below)

    Any help?

    Thanks!


    
    Option Explicit
    
    Private Sub worksheet_SelectionChange(ByVal Target As Range)
    
    If Target.Address = "$J$7" Then
    
        If UserForm_ManualRevAdj.Visible = False Then
    
            UserForm_ManualRevAdj.Show
    
        End If
    
    End If
    
    End Sub
    
    ------
    
    Private Sub worksheet_SelectionChange(ByVal Target As Excel.Range)
    
    'Prevents Users from changing sheet names
    
        If ActiveSheet.Name <> "Project Pricing Summary" Then
        ActiveSheet.Name = "Project Pricing Summary"
    
    End If
    End Sub

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: How to join these (specific) two sub routines (local to sheet)?

    You can't have two procedures with the same name in the same module.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      If Me.Name <> "Project Pricing Summary" Then Me.Name = "Project Pricing Summary"
    
      If Target.Address = "$J$7" Then
        If UserForm_ManualRevAdj.Visible = False Then UserForm_ManualRevAdj.Show
      End If
    End Sub
    Entia non sunt multiplicanda sine necessitate

+ 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] Join sheet in excel 2007
    By adekinteristi in forum Excel General
    Replies: 7
    Last Post: 10-27-2017, 12:34 PM
  2. Replies: 8
    Last Post: 08-09-2013, 06:10 AM
  3. Join Text Strings meeting specific criterias
    By esperanto in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-18-2013, 05:29 AM
  4. Download images from a list of urls (in excel sheet) to my local disk
    By anto888 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-25-2012, 04:02 AM
  5. [SOLVED] Local Range Name & Sheet Duplication
    By Kevin H. Stecyk in forum Excel General
    Replies: 0
    Last Post: 08-29-2005, 03:05 PM

Tags for this Thread

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