Results 1 to 2 of 2

Can't access 2nd worksheet

Threaded View

  1. #1
    Registered User
    Join Date
    09-25-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    62

    Can't access 2nd worksheet

    Hola,
    My issue is I can't access my 2nd workbook file when I use this code.
    This works when app. is on E: drive


    Sub DataLoad()
      'PURPOSE: This sub apppends Source Information Master File folder with approriate data
      'VARIABLE DIMENSION
      Dim strRANGE As String               'DATA RANGE
      Dim wbkActive As Workbook            'ActiveWorkbook
      Dim wsSourceData As Worksheet          'Data worksheet
      
      'VARIABLE SET
      Set wbkActive = Application.ActiveWorkbook
      Set wsSourceData = wbkActive.Worksheets("SourceData")
      strRNG1 = wbkActive.Names("RANGE1").RefersToRange
      
      
      'MAIN CODE
      wsSourceData.Range("A2:J2").Copy  'select the range A2 to J2, thats the data I need
    
      Application.Workbooks.Open ("E:\SOURCEDATAMASTER") ' Open the file to copy to
    
      Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial _
            Paste:=xlPasteValues  'find the last row containing data, and then plus one, then paste the data
    
      ActiveWorkbook.Close SaveChanges:=True 'close and save the masterfile workbook
    
    
      'wbkActive.Activate 'bring the Source Input workbook back to the front
    
    End Sub
    When I substitute a different file path the code does not recognize the 2nd workbook.

    Application.Workbooks.Open ("I:\SOURCE INSPECTION\SOURCEDATAMASTER")
    Any and all help will be appreciated!
    Last edited by SLIDE1; 12-06-2012 at 08:44 AM.

Thread Information

Users Browsing this Thread

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

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