LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Dave Peterson
 
Posts: n/a
Default How copy cell workbook to workbook?

This portion of your code looks suspicious:
Workbooks("counts.csv").Worksheets("summary").Cell s(2, 2).Value
When I open a .CSV file, the worksheet name is based on that file name.

If you change that worksheet name to Summary, then ignore this.

But this is one time I would use:
Workbooks("counts.csv").Worksheets(1).Cells(2, 2).Value
to get that first (and only) worksheet in the .CSV file.

wrote:

Thanks Dave + others,

"How would you ever know which workbook is workbooks(1) and which is
workbooks(2)? " was a good question / point.

I was also copying the wrong cells. The working code is now:

Sub Copy_Cell_from_2ndbook_to_1st_book()

' Copy 2nd book's B2 (2,2) to 1st book's E2 (2,5)
Workbooks("Book1.xls").Worksheets("sheet1").Cells( 2, 5).Value = _
Workbooks("counts.csv").Worksheets("summary").Cell s(2, 2).Value

MsgBox "Done"

End Sub


--

Dave Peterson
 
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
hpw do I logic test a cell then copy the row to diff. SS Debi Excel Worksheet Functions 4 October 5th 05 09:42 PM
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
How can I copy a cell from one page to all pages of a workbook? John Q Excel Worksheet Functions 2 April 12th 05 08:32 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 04:47 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"