![]() |
Consolidating via vba not updating properly
Hello,
I create a code (below) using the macro recorder to refresh the data connection and consolidate the sales figures. My problem is that the code only seems to refresh the data connection, but the data is not consolidating correctly. Now if I go to Data - Consolidate manually it works fine. How can I have my code work correctly that will consolidate properly. I made sure that I clear the contents before doing the consolidation. Can anyone help me. Thank you in advance. Cheers 'Refresh sales connection ActiveWorkbook.Connections("Query from SalesByDepartment").Refresh 'Consolidate revenue 'Revenue worksheet consolidation Worksheets("Revenue").Range("A3").Consolidate Sources:=Array( _ "'Z:\General Folder\Sales\Budget\[Revenue 2009.xlsm]Revenue'!R3C6:R40000C9" _ , _ "'Z:\General Folder\Sales\Budget\[Revenue 2009.xlsm]Revenue'!R3C11:R20000C14" _ ), Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False |
All times are GMT +1. The time now is 12:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com