+ Reply to Thread
Results 1 to 3 of 3

CopyPaste

  1. #1
    Ivica Lopar
    Guest

    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. #2
    Jim Thomlinson
    Guest

    RE: 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. #3
    ivica lopar
    Guest

    RE: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1