Trying to link data from two programs, getting "Run-time 1004: Method 'Range' of object '_Worksheet' failed"

UncleBajubjubs

Board Regular
Joined
Jul 11, 2017
Messages
111
Office Version
  1. 2010
Hello, I have a two excel workbooks, one (Workbook A) which is designed with a macro to pull in info from the other (Workbook B). Recently someone made changes to Workbook A that prevent the linking from occurring, but I do not know what they did. The VBA is identical to the an older version of the program which still works, so I assume the change exists on one of its worksheets. Since Workbook A is a massive program, (which is while it got separated from Workbook B as it slowed down Workbook B when they were one program a while ago) I assume it'd take forever to find the change.

The code in question is:

<code>
Sub LinkWorkbookB_Click()


Dim filename As Variant
Dim equals As String





Worksheets("Inputs").Unprotect

'Turn off Automatic Calculation
Application.Calculation = xlCalculationManual

' MsgBox "ThisWorkbook path is : " & ThisWorkbook.Path
filename = Application.GetOpenFilename()
If filename = False Then Exit Sub
' Range("ThisWorkbookPath") = ThisWorkbook.Path
Range("MechanicalProgramName") = filename






Range("AccelerationTime") = "='" & filename & "'!AccelerationTime"

</code>

Then are hundreds are variables that are linked, I only included the first one as that is the line that breaks, giving the "Run-time 1004: Method 'Range' of object '_Worksheet' failed" message. Any ideas?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Do you have a named range called AccelerationTime?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
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