Results 1 to 18 of 18

path to copied workbook problem

Threaded View

  1. #1
    Registered User
    Join Date
    06-05-2019
    Location
    romania
    MS-Off Ver
    2016
    Posts
    47

    path to copied workbook problem

    I have the following situation: A file - fisierzero.xlsm that is on the Desktop, and two other files: one in the laminate folder named laminate.xlsm and one in the monolit folder named monolit.xlsm.
    I guess I do not give the correct path in the VBA code because I have error 9 out of range error. all files are open.
    Private Sub Worksheet_Change(ByVal Target As Range)
    
        Dim wb     As Workbook
        Set wb = ThisWorkbook
        
        Dim keycells As Range
        Set keycells = Range("A:Z")
        
        Dim wb2    As Workbook
        Set wb2 = Workbooks("E:\monolit\monolit.xlsm")
        
        Dim wb3    As Workbook
        Set wb3 = Workbooks("E:\laminat\laminat.xlsm")
        
        Dim ws     As Worksheet
        Set ws = wb2.Sheets("Sheet1")
        
        Dim ws2    As Worksheet
        Set ws2 = wb3.Sheets("Sheet1")
        
        If Not Intersect(keycells, Range(Target.Address)) Is Nothing Then
            ws.Range(Target.Address).Value = wb.Sheets("Sheet1").Range(Target.Address)
            ws2.Range(Target.Address).Value = wb.Sheets("Sheet1").Range(Target.Address)
        End If
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. hyperlink path changes when copied to another workbook
    By SierraKilo78 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2014, 08:20 PM
  2. [SOLVED] When data is copied to another workbook, hyperlinks as not copied or they don't work
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-17-2014, 06:46 AM
  3. Data will be copied from a separate workbook to worksheet RawData in another workbook
    By pghpens44 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2014, 10:07 AM
  4. VBA Macro Won't UpdateLinks Automatically when Formula is Copied and File Path is Changed
    By justinbelkin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-18-2013, 01:32 PM
  5. Replies: 0
    Last Post: 02-29-2012, 01:40 PM
  6. Link to non-office file, update path when copied
    By Schipperus in forum Excel General
    Replies: 0
    Last Post: 07-02-2009, 09:53 AM
  7. Replies: 3
    Last Post: 08-23-2007, 04:47 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