PC Review


Reply
Thread Tools Rate Thread

Data Consolidation using dynamic path

 
 
Jholerjo
Guest
Posts: n/a
 
      17th Dec 2007
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
 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      17th Dec 2007
Maybe something like this - what word wrap in the email:

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

--
Regards,
Tom Ogilvy


"Jholerjo" wrote:

> 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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
data consolidation Stupac Microsoft Excel Worksheet Functions 1 5th Feb 2010 04:09 AM
Dynamic Array for data consolidation Len Microsoft Excel Programming 2 4th Feb 2010 01:27 AM
Data Consolidation =?Utf-8?B?Sm9obm55MTQ5Ng==?= Microsoft Excel Misc 3 16th Aug 2007 12:20 AM
Data Consolidation =?Utf-8?B?QWwgQWxsZW4=?= Microsoft Excel Worksheet Functions 1 18th Jul 2004 08:12 PM
data consolidation Allie Microsoft Excel Worksheet Functions 1 2nd Mar 2004 10:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:19 AM.