Results 1 to 3 of 3

Use cell value to determine which worksheet to open or activate.

Threaded View

  1. #1
    Registered User
    Join Date
    10-16-2012
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2010
    Posts
    54

    Use cell value to determine which worksheet to open or activate.

    Hello there,

    I'm working on a macro that lets me jump easily between workbooks and worksheets but I just can't seem to get it working.

    The cell reference C3 contains text which decides which workbook and worksheet I want to open/activate.
    Sub Open_or_Activate_pINFO()
    
        Dim sName As String
        sName = Range("C3")
    
    
           On Error GoTo ErrorHandler
              Workbooks.Open ("C:\Property Sheets\" & sName & ".xlsm")
       'The following line will halt the macro before the error handler is reached.
              Exit Sub
    ErrorHandler:
              Workbooks(sName & ".xlsm").Activate
              
              
    Sheet("sName").Activate
    
    End Sub
    Last edited by r2fro; 03-06-2014 at 07:59 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 10-10-2012, 05:10 PM
  2. Replies: 0
    Last Post: 07-05-2012, 02:16 AM
  3. Replies: 0
    Last Post: 07-04-2012, 07:27 PM
  4. Excel Function/Code to See if Workbook is Open and activate based on a cell value
    By jaycap55 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2009, 02:37 PM
  5. can't activate open workbook based on cell value
    By jseufert in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2009, 11:25 AM

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