LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 192
Default How to copy to a specific worksheet?

First, a reminder that I've long since lost what little VBA know-how I
had around 15-20 years ago, so basically I'm a novice.

Cut to the essentials, I want to copy cell B5 from one worksheet to C16
of another worksheet in another workbook.

I found this example of copying between worksheets:

http://analysistabs.com/excel-vba/co...et-to-another/

So thought I'd start with that simpler situation. I therefore first
opened Excel 365 and a new file (workbook?) called My Book 1.xlsm. I
then named two tabs (sheets) 'Source' and 'Destination' respectively. In
Source I typed 'Cell B5' into B5 and left Destination empty. I wrote the
following code:

Sub CopyBetweenWorksheetsInSameBook()

Sheets("Track Data").Range("B5").Copy Destination:=Sheets("Walk
Index").Range("C16")

End Sub

I ran it with F5 and it worked as expected.

Then I edited the macro to use one of my actual workbooks, adding two
sheets and using this code:

Sub CopyBetweenWorksheetsInSameBook()

Sheets("Track Data").Range("B5").Copy Destination:=Sheets("Walk
Index").Range("C16")

End Sub

That also worked OK. So I then tried to rewrite the macro to copy to a
specified different destination workbook. The file is called Walk
Index.xlsm and it's in the same folder as the source workbook. But this
didn't work:

Sub CopyTrackSheetCellsToWalkIndex()

Sheets("Track Data").Range("B5").Copy Destination:=Workbook("Walk
Index")Sheets("TEMP").Range("C16")

End Sub

Could someone put me straight on specifying the workbook and its
worksheet please?

Terry, East Grinstead, UK
 
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 specific data to another worksheet Jock Excel Programming 13 December 8th 09 09:49 PM
Copy specific data to second worksheet Andre7266 New Users to Excel 4 May 13th 08 08:39 PM
Copy specific data over to other worksheet dd Excel Programming 1 December 19th 06 09:24 AM
copy specific records to new worksheet violet Excel Programming 1 September 22nd 06 01:31 PM
Copy Worksheet to specific row in another workbook GregR Excel Programming 0 June 28th 05 07:08 PM


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

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"