View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Coping Range from another Excel file

By external file, I assume you mean a different workbook. To access data in
a different workbook than the one your code is running in, you must specify
that workbook in the calling code.

ActiveWorkbook.Sheets(1).Range("A1") = _
Workbooks("myWB2").Sheets(1).Range("B1")

So when you try to use a variable to capture the data from another workbook,
the variable must contain the workbook reference also.

Set myVar = Workbooks("myWB2").Sheets(1)
ActiveWorkbook.Sheets(1).Cells(1, 1) = myVar.Range("B1")
" wrote:

Hi...

I am developing a application in Excel 2003 with userforms, that
requires a Range to be copied from external other excel file to a
specified sheet on the coding file. i tried using Inputbox(type 8) and
also ref edit function. Both links only sheets of the file and they
never point to the external file.
Any suggestions...?

Thanks
S.Ramesh