![]() |
CopyPaste
I wont copy range of cells from one workbook1 and then paste values in
another workbook2.( I have userform in it) I wont to do this with click on comandbutton1. In textbox1 I have path of workbook. Can I do this without opening workbook1. |
CopyPaste
You have to have both workbooks open. Here is some generic code for you to
play with... 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 '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 wksSource.Copy wksDestination rngSource.Copy rngDestination Exit Sub OpenBook: Set wbkDestination = Workbooks.Open("C:\Thatbook.xls") Resume Next Exit Sub End Sub -- HTH... Jim Thomlinson "Ivica Lopar" wrote: I wont copy range of cells from one workbook1 and then paste values in another workbook2.( I have userform in it) I wont to do this with click on comandbutton1. In textbox1 I have path of workbook. Can I do this without opening workbook1. |
CopyPaste
I have seven columns and 10 rows with some values.
in column "a" is constant string. Now in userform I have 7 text boxes. I wont when I change value in textbox that value is change in worksheet is that posiblle. regards lop *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 02:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com