Hi
I have this VBA that work for me, but I want to update my sheet without opening the other file. any idea how i can do this?
thanks in advance.
Option Explicit
Sub test()
Dim wb As Workbook, wb2 As Workbook
Dim ws As Worksheet
Dim vFile As Variant
'Set source workbook
Set wb = ActiveWorkbook
'Open the target workbook
vFile = Application.GetOpenFilename("Excel-files,*.xls", _
1, "Select One File To Open", , False)
'if the user didn't select a file, exit sub
If TypeName(vFile) = "Boolean" Then Exit Sub
Workbooks.Open vFile
'Set targetworkbook
Set wb2 = ActiveWorkbook
'For instance, copy data from a range in the first workbook to another range in the other workbook
wb.Worksheets("Sheet1").Range("b5:g42").Value = wb2.Worksheets("POMaster").Range("b5:g42").Value
End Sub
Bookmarks