range.copy method throwing unexpected error

0

I have the following code to copy data between 2 different excel files

xlRangeSource = xlsheetSource.Range("B2:K" & IntAmountOfRows)
xlRangeTarget = xlsheetTarget.Range("A" & intStartOfEmptyRow)
xlRangeSource.Copy(Destination:=xlWbTarget.Worksheets(xlsheetTarget).range(xlRangeTarget))

IntAmountOfRows and intStartOfEmptyRow are both integers

When executing my code, I get the following error:

Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

However, I am using a range to copy to a range. I don't understand why the types are a mismatch

vb.net
excel
asked on Stack Overflow Nov 4, 2013 by Gutanoth • edited Nov 4, 2013 by Gutanoth

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0