Glasgowsmile
Active Member
- Joined
- Apr 14, 2018
- Messages
- 280
- Office Version
- 365
- Platform
- Windows
Good day,
I've got the below VBA code which works but after it runs when I look at the tab it has the range use selected still. It's not a huge issue but I'm curious, how do I remove that selection on each tab?
I've got the below VBA code which works but after it runs when I look at the tab it has the range use selected still. It's not a huge issue but I'm curious, how do I remove that selection on each tab?
VBA Code:
Private Sub CommandButton1_Click()
Application.DisplayAlerts = False
Dim crnt As Workbook
Dim source As Workbook
With Application.FileDialog(msoFileDialogOpen)
.Filters.Clear
.Filters.Add "Files", "*.xlsm"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
Workbooks.Open .SelectedItems(1)
Set source = ActiveWorkbook
Worksheets("Dtar").Range("A3:K365").Copy
Sheet1.Range("A3").PasteSpecial xlPasteValues
Worksheets("Mtar").Range("A3:A365").Copy
Sheet2.Range("A3").PasteSpecial xlPasteValues
Worksheets("Mtar").Range("C3:H365").Copy
Sheet2.Range("C3").PasteSpecial xlPasteValues
source.Close savechanges:=False
End If
End With
Sheets("Import_old").Activate
Range("A1").Select
Application.CutCopyMode = False