Copy worksheet acting odd

kckay

Board Regular
Joined
Nov 8, 2010
Messages
134
I am running the following code:
Code:
Set wkb = ActiveWorkbook
        With Workbooks.Open(Filename:="C:\Sourcewb\blank.xlsm")
                       .Worksheets("Lookup Tables").Copy Before:=wkb.Worksheets(1)
         .close SaveChanges:=False
        End With

These lines of code

These lines of code operates correctly on my machine. The code does not work when run on another machine.

I am at a loss as to why it works on one machine, but not another.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
You code is referencing a file path and file name found on your hard-drive (C:\Sourcewb\blank.xlsm). Does that file path and file exist on the other computers too?
 
Upvote 0
The directory is created, but is the file? Have you tried copying the file to the same location on the other system to see if it worked?
 
Upvote 0
Just re-checked. The directory is created and the file is, too. The target workbook does not have the sheet that is supposed to be copied from the source workbook.
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,487
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top