Problem with a path\filename

gang-tsou

New Member
Joined
Nov 7, 2005
Messages
1
I have a problem with the consolidate command.

Selection.Consolidate Sources:= _
"'C:\Travaux Charles\Gis 114\[Gis114-10-21-TP7-macros pour les CAR.xls]CAR Ameublements Fred inc.'!R1C1:R23C3" _
, Function:=xlSum, TopRow:=True, LeftColumn:=True, CreateLinks:=False

The problem is that function refer to a file in a directory, if i change the file to a new directory i get an error message : cannot open file, 'cause excel cannot find the file where it is supposed to be. What can I do ?
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi gang-tsou,
Welcome to the board !

If the file that you need is in the same map as the file where you use the formula, you could use some code like :

MyPath = thisworkbook.Path & "\"
Selection.Consolidate Sources:= _
MyPath & "[Gis114-10-21-TP7-macros pour les CAR.xls]CAR Ameublements Fred inc.'!R1C1:R23C3" _
, Function:=xlSum, TopRow:=True, LeftColumn:=True, CreateLinks:=False
 
Upvote 0

Forum statistics

Threads
1,203,502
Messages
6,055,772
Members
444,822
Latest member
Hombre

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