copy worksheet without opening the workbook

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi all,

I would like ask if there's a way to copy a worksheet from a workbook A into
workbook B, without actually opening workbook A?

Thanks,

Ben

--
 
you can do it using formula.
try following:

Sub GetData()
Dim mydata As String
'data location & range to copy
mydata = "='C:\[NewBook.xls]Sheet1'!$B$2:F12" '<< change as required

'link to worksheet
With Worksheets(1).Range("B2:F12") '<< change as required
.Formula = mydata

'convert formula to text
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Application.CutCopyMode = False
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top