#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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 ***
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
FormatConditions appears to kill copypaste [email protected] Excel Programming 2 October 18th 05 11:06 PM
VBA code need help on CopyPaste alienscript Excel Programming 5 December 18th 03 04:51 PM


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