Any help would be appreciated. I'm simply trying to copy a group of cells I've got selected in a separate workbook to the existing sheet.
This chunk of code works when I'm testing it in 2 sheets that are in the same file
I need to make it work while I'm pointing to a different file.
This Errors Out
The application.copy works. I don't know how to structure the 'Pastespecial'. I've used the code to reference other workbooks many times. I'm actually editing in a code that was working for a slightly different application. The sheet I want the information in is open and selected. The sheet it's coming from is open in an instantiated instance.
The error comes on the first .Pastespecial and says: error 1004 Pastespecial method of Range class failed
thx
This chunk of code works when I'm testing it in 2 sheets that are in the same file
Code:
Selection.Copy
With Sheets("testdump").Range("B" & y).End(xlToLeft).Offset(, 1)
.PasteSpecial xlPasteFormats, Transpose:=True
.PasteSpecial xlPasteValues, Transpose:=True
End With
I need to make it work while I'm pointing to a different file.
This Errors Out
Code:
Dim appXL As Excel.Application
Dim wbk As Excel.Workbook
Set appXL = New Excel.Application
Set wbk = appXL.Workbooks.Open(GrabIt)
...
appXL.Selection.Copy
With Sheets("Sheet1").Range("B2").End(xlToLeft).Offset(, 1)
.PasteSpecial xlPasteFormats, Transpose:=True
.PasteSpecial xlPasteValues, Transpose:=True
End With
The application.copy works. I don't know how to structure the 'Pastespecial'. I've used the code to reference other workbooks many times. I'm actually editing in a code that was working for a slightly different application. The sheet I want the information in is open and selected. The sheet it's coming from is open in an instantiated instance.
The error comes on the first .Pastespecial and says: error 1004 Pastespecial method of Range class failed
thx