+ Reply to Thread
Results 1 to 3 of 3

Error message when trying to copy a sheet

  1. #1
    Registered User
    Join Date
    10-29-2021
    Location
    Tromsų, Norway
    MS-Off Ver
    Office 365
    Posts
    2

    Error message when trying to copy a sheet

    Hello!

    I have copied this macro from another forum and managed to adapt it to my purpose. Now when I moved it to another joined server, it doens't work anymore. I get an error message when trying to copy the sheet ("Kontrakt"). As I am a total beginner in VBA, I struggle to understand why, even though I believe that's because something wrong at the beginning of the macro.

    Could anyone help? I believe this is quite simple, but as a beginner it's impossible for me t find out a solution.

    Regards!

    Emmanuel


    Sub Makro1()

    Dim arbeidsark As Worksheet, i&, nomf$
    Set arbeidsark = Worksheets("Liste over sensorer")
    For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
    nomf = Range("A" & i)

    vekting = Range("C" & i)
    fagansvarlig = Range("B" & i)
    dato = Range("D" & i)

    Worksheets("Kontrakt").Copy

    Range("I27") = nomf & " " & eksamensform
    Range("L30") = vekting
    Range("O27") = fagansvarlig

    With ActiveWorkbook
    .SaveAs ThisWorkbook.Path & "\" & "Sensorkontrakt" & " " & nomf & " " & eksamensform & ".xlsx"
    .Close
    End With

    Next i
    End Sub

  2. #2
    Registered User
    Join Date
    01-27-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    19

    Re: Error message when trying to copy a sheet

    Hi,

    If you have copied the file from a local drive to a network drive then I would check the file path is still correct as it may have changed from "\" to "/"
    If not include the error message and someone may be able the help further.

  3. #3
    Registered User
    Join Date
    10-29-2021
    Location
    Tromsų, Norway
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Error message when trying to copy a sheet

    Hi,

    Thanks for your reply. I tried to change from "\" to "/", but the result is the same.

    I get the following error message:

    Path/File access error:`.\VBDB5C.tmp'

    If that makes sense to someone.

    Emmanuel

+ 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. Query on Excel sheet returns error, how to prevent error message
    By rgsbouma in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-02-2019, 01:38 PM
  2. Need Help with error message for my sheet
    By dougers1 in forum Excel General
    Replies: 3
    Last Post: 05-16-2017, 07:23 AM
  3. Error message encountered when trying to copy a tab
    By friend11_6 in forum Excel General
    Replies: 1
    Last Post: 07-01-2008, 11:13 PM
  4. copy sheet error message
    By brucearthurhall in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-21-2006, 09:25 AM
  5. Copy Worksheet Error Message
    By rratcliffe in forum Excel General
    Replies: 0
    Last Post: 06-01-2005, 03:19 PM
  6. Cell Copy Error Message
    By Gabe Swan in forum Excel General
    Replies: 1
    Last Post: 03-15-2005, 08:06 PM
  7. Cell Copy Error Message
    By gswan in forum Excel General
    Replies: 0
    Last Post: 03-15-2005, 07:06 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