LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Data Consolidation using dynamic path

Hi All,

I need help with data consolidation. I have hardcoded file for data
consolidations as follows:

Range("B6").Select
Selection.Consolidate Sources:=Array( _
"'G:\Loss Mitigation\Unsecured Reporting\MMT\Watchlist Template\[MMT
- Watchlist 1-45 Workbook Dec 07 Wk1.xls]Summary'!R6C2:R17C7" _
, _
"'G:\Loss Mitigation\Unsecured Reporting\MMT\Watchlist Template\[MMT
- Watchlist 1-45 Workbook Dec 07 Wk2.xls]Summary'!R6C2:R17C7" _
, _
"'G:\Loss Mitigation\Unsecured Reporting\MMT\Watchlist Template\[MMT
- Watchlist 1-45 Workbook Dec 07 Wk3.xls]Summary'!R6C2:R17C7" _
, _
"'G:\Loss Mitigation\Unsecured Reporting\MMT\Watchlist Template\[MMT
- Watchlist 1-45 Workbook Dec 07 Wk4.xls]Summary'!R6C2:R17C7" _
), Function:=xlSum, TopRow:=False, LeftColumn:=False, CreateLinks:= _
False
Range("B19").Select

It works. BUt when I change that to variables using this code:

Sub Consolidate_Cured()
'
Dim strFilePath As String
Range("B6").Select
strFilePath = ActiveWorkbook.Path

Selection.Consolidate Sources:=Array( _
" ' "& strFilePath &"\"& [MMT - Watchlist 1-45 Workbook Dec 07
Wk1.xls]Summary'!R6C2:R17C7" _
, _
" ' "& strFilePath &"\"& [MMT - Watchlist 1-45 Workbook Dec 07
Wk2.xls]Summary'!R6C2:R17C7" _
, _
" ' "& strfilePath &"\"& [MMT - Watchlist 1-45 Workbook Dec 07
Wk3.xls]Summary'!R6C2:R17C7" _
' _
" ' "& strFilePath &"\"& [MMT - Watchlist 1-45 Workbook Dec 07
Wk4.xls]Summary'!R6C2:R17C7" _
), Function:=xlSum, TopRow:=False, LeftColumn:=false, CreateLinks:= _
False

Range("B19").Select
End Sub

and VB return error said :compile error expected: List separator or ).
Can Anybody help me with the syntax please?

Thank You very3x much...
Jeff
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic path for dll ojv[_2_] Excel Programming 1 June 7th 07 02:54 PM
Open files from a dynamic path.. Arjan Excel Programming 8 November 28th 06 06:18 AM
Dynamic directory path Newbie Excel Discussion (Misc queries) 1 April 24th 06 04:56 PM
setting a dynamic path in an excel query Glen[_5_] Excel Programming 3 February 1st 06 04:35 PM
Making path of linked cell dynamic Negentropy Excel Discussion (Misc queries) 3 September 24th 05 09:02 PM


All times are GMT +1. The time now is 06:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"