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.
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.
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.
>
>
>
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 ***
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks