Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default cells from another workbook

I have the following code that works in a loop

Cells(j, 2) = Sheets("Sheet1").Cells(j, 5)

What I am struggling to do is get this to work when "Sheet1" is in another
workbook (that will be open). Is there code that would read something like:

Cells(j, 2) = Workbooks("Base Data.xls").Sheets("Sheet1").Cells(j, 5)

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default cells from another workbook

The code you wrote should work assuming the file Base Data.xls is open and
there is a sheet named Sheet1 in that workbook.

Mike



"fullers" wrote:

I have the following code that works in a loop

Cells(j, 2) = Sheets("Sheet1").Cells(j, 5)

What I am struggling to do is get this to work when "Sheet1" is in another
workbook (that will be open). Is there code that would read something like:

Cells(j, 2) = Workbooks("Base Data.xls").Sheets("Sheet1").Cells(j, 5)

Thanks in advance

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
Copy cells based on conditions in one workbook to another workbook fLiPMoD£ Excel Discussion (Misc queries) 0 August 1st 07 07:43 PM
Copy cells based on conditions in one workbook to another workbook fLiPMoD£ Excel Worksheet Functions 0 August 1st 07 07:43 PM
workbook linking cells not working within a workbook martyn Excel Discussion (Misc queries) 1 November 3rd 06 12:11 PM
referencing workbook from cells in another workbook jlejehan[_3_] Excel Programming 2 May 3rd 06 03:24 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM


All times are GMT +1. The time now is 02:02 PM.

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

About Us

"It's about Microsoft Excel"