Hacklin337
New Member
- Joined
- Jul 9, 2021
- Messages
- 3
- Office Version
- 2010
Hello,
I need help with this code:
I need this thing to work the same exact way but, when in the selection window i press nothing or cancel, nothing is copied (there is no selection error)
Thank you for any help
I need help with this code:
VBA Code:
Sub OTWIERANIEXLS3()
Dim customerBook As Workbook
Dim filter As String
Dim caption As String
Dim customerFilename As String
Dim customerWorkbook As Workbook
Dim targetWorkbook As Workbook
Set targetWorkbook = Application.ActiveWorkbook
filter = "Text files (*.xls),*.xls"
caption = "Please select your route"
customerFilename = Application.GetOpenFilename(filter, , caption)
Set customerWorkbook = Application.Workbooks.Open(customerFilename)
Dim targetSheet As Worksheet
Set targetSheet = targetWorkbook.Worksheets(1)
Dim sourceSheet As Worksheet
Set sourceSheet = customerWorkbook.Worksheets(1)
targetSheet.Range("CA1", "CJ201").Value = sourceSheet.Range("A1", "J201").Value
customerWorkbook.Close
End Sub
I need this thing to work the same exact way but, when in the selection window i press nothing or cancel, nothing is copied (there is no selection error)
Thank you for any help