Hello
I use this code to sum the whole column(G) from DATA file and populate value in A1 for MASTER file .
I have to make both files are open . How I make DATA file is closed after brings value without the file has already open?
thanks
I use this code to sum the whole column(G) from DATA file and populate value in A1 for MASTER file .
I have to make both files are open . How I make DATA file is closed after brings value without the file has already open?
VBA Code:
Sub test()
Dim wb1, wb2 As Workbook
Set wb1 = Workbooks("MASTER")
Set wb2 = Workbooks("DATA")
wb1.Sheets("Sheet1").Cells(1, 1).Value = Application.Sum(wb2.Sheets("MAIN").Columns(7))
End Sub