We help IT Professionals succeed at work.
Get Started

Excel VBA to copy specific worksheet to Active workbook

DougDodge asked
Last Modified: 2016-03-22
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
    Workbooks.Open Filename:=strFileToOpen
End If

End Sub

And the following to select the used range once the file is open:

Sub SelectDateToCopy()


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......
Watch Question
Mechanical Engineer
Most Valuable Expert 2013
Distinguished Expert 2020
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE