Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
move a sheet to another workbook | Excel Discussion (Misc queries) | |||
Move data within workbook | Excel Discussion (Misc queries) | |||
automatically move cell data in 1 workbook to another workbook | Excel Worksheet Functions | |||
can't move my workbook, top bar hidden | Excel Discussion (Misc queries) | |||
MOVE Worksheet to another workbook ? | Excel Programming |