Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How do I 'move' cells from one workbook to another?

I have two open workbooks and using a control button I would like to move
various cells from one workbook to another. There will be different numbers
of rows each time but the columns will remain the same.

I am using Excel 2002.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default How do I 'move' cells from one workbook to another?

Without knowing more about what is being copied from where to where it is
hard to comment. Here is some very generic code to copy from one sheet to
another...

Sub Test()
Dim wbkSource As Workbook
Dim wbkDestination As Workbook
Dim wksSource As Worksheet
Dim wksDestination As Worksheet
Dim rngSource As Range
Dim rngDestination As Range

'Set your source
Set wbkSource = ThisWorkbook
Set wksSource = wbkSource.Sheets("Sheet1")
Set rngSource = wksSource.Cells 'Everything on sheet 1

'Set your destination
On Error GoTo OpenBook
Set wbkDestination = Workbooks("ThatBook.xls")
On Error GoTo 0
Set wksDestination = wbkDestination.Sheets("Sheet1")
Set rngDestination = wksDestination.Range("A1")

'You now have all of your souce and destination objects

rngSource.Copy rngDestination

Exit Sub

OpenBook:
Set wbkDestination = Workbooks.Open("C:\Thatbook.xls")
Resume Next
Exit Sub

End Sub
--
HTH...

Jim Thomlinson


"ndm berry" wrote:

I have two open workbooks and using a control button I would like to move
various cells from one workbook to another. There will be different numbers
of rows each time but the columns will remain the same.

I am using Excel 2002.

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
move a sheet to another workbook phil-rge-ee Excel Discussion (Misc queries) 1 March 2nd 08 01:34 AM
Move data within workbook gregatvrm Excel Discussion (Misc queries) 2 August 27th 07 06:50 PM
automatically move cell data in 1 workbook to another workbook Genesis Excel Worksheet Functions 1 November 5th 06 07:35 PM
can't move my workbook, top bar hidden Macil Excel Discussion (Misc queries) 1 January 27th 06 04:52 PM
MOVE Worksheet to another workbook ? MAS Excel Programming 6 July 3rd 05 10:37 PM


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