View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TMesh TMesh is offline
external usenet poster
 
Posts: 5
Default Copying and Pasting cells within an Add-In

Hello

I am putting together an Excel Add-In for a client. One function of the
add-in needs to perform is to give the client the capability to save values
entered as default.

So I have a sheet within the add-in to store the values entered.

The Userform uses the Spreadsheet control from the Microsoft Office Web
Components. The following line of code works, which copies a range of cells
in the control to the clipboard:

xlsExpectedStarts.ActiveSheet.Range(xlsExpectedSta rts.ActiveSheet.ViewableRange).Copy

I am getting the following error when I try and paste the contents to the
worksheet to store the defaults.

Run-time error '-2147024809 (80070057)':
Invalid Argument.

I have tried to specify the range to copy to within the copy statement as
follows:

ThisWorkbook.Sheets("shtT1_Default").Range("rngEST _T1")

I have also tried to paste the cells after the copy statement as follows:

shtPaste = ThisWorkbook.Sheets("shtT1_Default").Range("rngEST _T1").Select
shtPaste.Paste

I get the same error message.

I have used the copy statement by itself and the used Ctrl-V to paste the
cells into a new sheet. So it works, but I have not found the right way to
specifiy it in code.

Any help would greatly be appreciated.

Thanks in advance
Tom Meschede