I am hoping to find code to copy cells of a workbook worksheet in sheet called "TASK", and paste into the active workbook. But ask the user which worksheet in the active workbook to copy to first.
So far the code I have uses the GetOpenFilename:
Sub FileDialogImport()
Dim strFileToOpen As String
strFileToOpen = Application.GetOpenFilename(Title:="Please Choose A File To Open For Import", FileFilter:="Excel Files *.xls* (*.xls*),")
If strFileToOpen = "" Then
MsgBox "No File Selected.", vbExclamation, "Sorry!"
Exit Sub
Else:
Workbooks.Open Filename:=strFileToOpen
End If
End Sub
And the following to select the used range once the file is open:
Sub SelectDateToCopy()
ActiveSheet.UsedRange.Copy
End Sub
It does not matter if the source file is opened or not, I just want to copy the used range on the worksheet "TASK"
The user should be asked which sheet to paste to for a destination.
Hope I explained this well enough......
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.