Hi!
I need a macro to open a workbook (TimeSerierData.xlsm) and copy the data in the workbook into an array and then sum data by month and then put the result in another workbook called MonthSerierData.xlsm.
here the data in TimeSerierData.xlsm
here is the code so far.
thanks in advance and any help is appreciated[h=3][/h]
I need a macro to open a workbook (TimeSerierData.xlsm) and copy the data in the workbook into an array and then sum data by month and then put the result in another workbook called MonthSerierData.xlsm.
here the data in TimeSerierData.xlsm
Code:
Time Value
2013.01.01 01:00:00 522
2013.01.01 02:00:00 411
2013.01.01 03:00:00 223
---and so on till next day and next month--
Code:
sub OpenAndInsert()
dim wbOut as workbook
dim wbIn as workbook
dim ws as worksheet
dim sPath as string
Dim sFile as string
dim MyArray as string
set ws as thisworkbook.worksheets("Info")
sPath = ws.range("A2")
sFile = ws.range("A3")
set wbOut = application.workbooks(sPath & sFile).open
MyArray = wbout.worksheet("Time").Range("A1:B50").copy
application.workbooks(sPath & sFile).close
------ work with array and sum data by month ----
set wbOut = application.workbooks(c:\temp\MonthSerierData.xlsm).open
-------- put the sum data too the workbook---
application.workbooks(c:\temp\MonthSerierData.xlsm).close
thanks in advance and any help is appreciated[h=3][/h]
Last edited: