Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Import Cell Values From An Unopen XLS File

Hello all. I am trying to copy values from an unopened Excel spreadsheet to
one that I have open. I cannot figure out how to do this. When I use the
following, cells from the open sheet get selected:

Set xlw = xl.Workbooks.Open("F:\Larry\TEST1_Backup.xls")
xlw.Activate
xlw.Sheets("Field Sheet").Select
Range(Cells(1, 1), Cells(150, 6)).Copy

I am using Excel 2000. Please help. TIA.

Larry


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Import Cell Values From An Unopen XLS File

Dim Wb1 As Workbook 'Workbook to copy to
Set Wb1 As ActiveWorkbook
Dim Wb2 As Workbook ' Workbook to copy from
Set Wb2 = Workbooks.Open("F:\Larry\TEST1_Backup.xls")

Wb2.Sheets("Field Sheet").Range(Cells(1, 1), Cells(150, 6)).Copy
Destination:= Wb1.Sheets("YourSheet").Range("YourRange")
Wb2.Close False

or

Wb2.Sheets("Field Sheet").Range(Cells(1, 1), Cells(150, 6)).Copy
Wb1.Sheets("YourSheet").Range("YourRange").PasteSp ecial xlPasteValues


Regards,

Alan


"vbman" wrote in message
news:yIeGh.377$3i.360@trnddc01...
Hello all. I am trying to copy values from an unopened Excel spreadsheet
to
one that I have open. I cannot figure out how to do this. When I use the
following, cells from the open sheet get selected:

Set xlw = xl.Workbooks.Open("F:\Larry\TEST1_Backup.xls")
xlw.Activate
xlw.Sheets("Field Sheet").Select
Range(Cells(1, 1), Cells(150, 6)).Copy

I am using Excel 2000. Please help. TIA.

Larry




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Import Cell Values From An Unopen XLS File

Hi vbman

See
http://www.rondebruin.nl/copy7.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"vbman" wrote in message news:yIeGh.377$3i.360@trnddc01...
Hello all. I am trying to copy values from an unopened Excel spreadsheet to
one that I have open. I cannot figure out how to do this. When I use the
following, cells from the open sheet get selected:

Set xlw = xl.Workbooks.Open("F:\Larry\TEST1_Backup.xls")
xlw.Activate
xlw.Sheets("Field Sheet").Select
Range(Cells(1, 1), Cells(150, 6)).Copy

I am using Excel 2000. Please help. TIA.

Larry


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Import Cell Values From An Unopen XLS File

You description is inconsistent. If you want to copy cells from the
currently open workkbook (the active book when you start the macro

set sh = Activesheet
Set xlw = xl.Workbooks.Open("F:\Larry\TEST1_Backup.xls")
xlw.Activate
xlw.Sheets("Field Sheet").Select
sh.Range(sh.Cells(1, 1), sh.Cells(150, 6)).Copy _
Destination:=Activesheet.range("A1")

if you want to select the cells on Field Sheet of workbook Test1_backup.xls,
it should do that now. however, you can do

Set sh = Activesheet
Set xlw = xl.Workbooks.Open("F:\Larry\TEST1_Backup.xls")
xlw.Activate
With xlw.Sheets("Field Sheet")
.Select
.Range(.Cells(1, 1), .Cells(150, 6)).Copy _
Destination:= h.Range("A1")
End With


--
Regards,
Tom Ogilvy


"vbman" wrote in message
news:yIeGh.377$3i.360@trnddc01...
Hello all. I am trying to copy values from an unopened Excel spreadsheet
to
one that I have open. I cannot figure out how to do this. When I use the
following, cells from the open sheet get selected:

Set xlw = xl.Workbooks.Open("F:\Larry\TEST1_Backup.xls")
xlw.Activate
xlw.Sheets("Field Sheet").Select
Range(Cells(1, 1), Cells(150, 6)).Copy

I am using Excel 2000. Please help. TIA.

Larry




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
import file so that it is a actual csv file, no excel cell version broncoburt New Users to Excel 1 November 21st 09 09:09 PM
Import values from a cell or a range of cells Sri Harsha[_2_] Excel Worksheet Functions 0 September 8th 09 09:04 AM
Import only certain cell values into a new work book Jeremy Excel Discussion (Misc queries) 0 February 12th 08 08:23 PM
how could I import a text file with comma separated values into ex Xavi Excel Worksheet Functions 1 September 15th 05 11:27 AM
Find Text File Import Cell ExcelMonkey Excel Programming 4 August 8th 05 02:43 PM


All times are GMT +1. The time now is 08:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"