DougDodge
asked on
Excel VBA to copy specific worksheet to Active workbook
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.GetOpenFilenam e(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......
So far the code I have uses the GetOpenFilename:
Sub FileDialogImport()
Dim strFileToOpen As String
strFileToOpen = Application.GetOpenFilenam
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......
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.