I have file MAIN.xlsm with Macro and two sheets "A1", "A2".
When I Press "Get DATA" button I want to copy data from sheet "G000141" into "A1" and sheet "G000142" into "A2" (G000141, G000142 from another WB)
plz help do that, this's my code but it's not working.
Thanks in advanced./.
When I Press "Get DATA" button I want to copy data from sheet "G000141" into "A1" and sheet "G000142" into "A2" (G000141, G000142 from another WB)
plz help do that, this's my code but it's not working.
PHP:
Sub Ngoai1()On Error Resume NextDim basebook As StringDim mybook As WorkbookDim fname As StringDim Mypath As String
Application.ScreenUpdating = FalseMypath = Application.ActiveWorkbook.Pathbasebook = ActiveWorkbook.Name
ChDrive MypathChDir Mypath
fname = Application.GetOpenFilename(filefilter:="Execel files (*.xlsx), *.xlsx", Title:="Chon file nguon", MultiSelect:=False)Set mybook = Workbooks.Open(fname)mybook.Worksheets(1).ActivateRange("C19:I785").SelectRange(Selection, Selection.End(xlDown)).SelectSelection.CopyWindows(basebook).ActivateSheet1.SelectRange("A1").SelectActiveSheet.PasteRange("A4").SelectApplication.CutCopyMode = Falsemybook.Close FalseApplication.ScreenUpdating = True
End Sub
Thanks in advanced./.