Macro

ryansm05

Board Regular
Joined
Sep 14, 2016
Messages
148
Office Version
  1. 365
Platform
  1. Windows
Hi,

A user is having issues trying to open a file with the below macro code. I don't believe this is an issue for anyone else.

The code and error are both below.

Does anyone have an idea of what this relates to?

Thanks in advance
Ryan



Code:
Private Sub Workbook_Open()    Application.WindowState = xlMaximized
    Call MonkeyNuts
End Sub
Sub MonkeyNuts()


    Dim wkb As Workbook: Set wkb = Workbooks.Open("I:\Content & Creative\Design Admin\_Revenue\Control\Data.xlsx", True, True)
    Dim LR  As Long
    
    With wkb
        'Change the sheetname "Time" to name of second sheet. Or use Sheets(2), assuming the index number of the sheet relates to the second sheet shown in your spreadsheet
        LR = .Sheets("Time").Cells(.Sheets("Time").Rows.Count, 1).End(xlUp).Row
        ThisWorkbook.Sheets("Time").Range("B1:Y30000").Value = .Sheets("Time").Range("A1:X30000").Value
        
        LR = .Sheets("Jobs").Cells(.Sheets("Jobs").Rows.Count, 1).End(xlUp).Row
        ThisWorkbook.Sheets("Jobs").Range("A1:Z2000").Value = .Sheets("Jobs").Range("A1:Z2000").Value
        
        LR = .Sheets("Billing").Cells(.Sheets("Billing").Rows.Count, 1).End(xlUp).Row
        ThisWorkbook.Sheets("Billing").Range("A1:Q30000").Value = .Sheets("Billing").Range("A1:Q30000").Value
        
        LR = .Sheets("Costs").Cells(.Sheets("Costs").Rows.Count, 1).End(xlUp).Row
        ThisWorkbook.Sheets("Costs").Range("A1:U30000").Value = .Sheets("Costs").Range("A1:U30000").Value
        
        .Close False
    End With
    
    Sheets("CC").Select
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Which line of VBA code gets highlighted if you hit debug?
That is where you want to focus your attention.

A good possibility is that they may not have the I drive mapped the same as everyone else, so the file path in your code may be invalid for them.
 
Upvote 0
I've not been able to test this on my colleagues machine as of yet, so as far as I can see there is no error within the code (as it runs correctly for me).

Thanks for the suggestion regarding the mapping of the I:\ drive - I've raised this question with my IT department and will let you know what they say.

Thanks
Ryan
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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