Hi All, Please Help!
I am trying to copy data from hidden sheet on one workbook to another workbook window open using a command button. The workbooks are on seperate drives.
data range to copy is from A2:Y200 from P:\folder\sheet1 (sheet1 is hidden and workbook not open)
paste to D3:AB200 into Z:\folder\sheet2 (Active window and sheet command button is on)
Everything i try gives a runtime error.
I tried just recording the macro and get an out of memory error.
Any suggestions would be greatly appreciated.
Right now I can't even get it to work with the hidden sheet visible as it gets hung up on the range to paste. Can you please adjust for me:
[Private Sub CommandButton1_Click()
Dim Wkb1 As Workbook
Dim Wkb2 As Workbook
Dim rngToCopy As Range
Dim rngToPaste As Range
' set the workbook you are copying to as active and give it a name for reference
Set Wkb1 = ActiveWorkbook
' open the workbook you are copying from and activate it
Set Wkb2 = Workbooks.Open(Filename:="C:\Users\Foldername\EA.xlsm")
Wkb2.Activate
With Worksheets("Data")
Set rngToCopy = .Range("A2", "Y200")
End With
With rngToCopy
Set rngToPaste = Worksheets("Matrix").Range("D3:AB200")
End With
rngToPaste.Value = rngToCopy.Value
End Sub \]
Bookmarks