I have a code which should open input file and copy from there some specific columns. This macro not showing any bug its working but nothing happend, i dont see any action. I have Excel 2016
Sub btnExport_Click()
Dim strPath As String
Dim wbMe, wb As Workbook
strPath = selectFile
If strPath = "" Then Exit Sub
Set wbMe = ActiveWorkbook
Set wb = Workbooks.Open(strPath, False, True)
wb.Sheets(1).Columns("A:C").Copy Destination:=wbMe.Sheets(1).Range("A1")
wb.Sheets(1).Columns("H").Copy Destination:=wbMe.Sheets(1).Range("D1")
wb.Close False
Set wb = Nothing
Beep
MsgBox "The data was imported"
End Sub
Private Function selectFile()
Dim fd As Office.FileDialog
Set fd = Application.FileDialog(3)
With fd
.InitialFileName = ActiveWorkbook.Path
.AllowMultiSelect = False
.Title = "Please select file to import."
.Filters.Clear
.Filters.Add "Excel", "*.xlsm"
If Show = True Then selectFile = .SelectedItems(1)
End With
End Function