+ Reply to Thread
Results 1 to 4 of 4

How to copy cells to same place but in another document?

  1. #1
    Forum Contributor
    Join Date
    02-23-2015
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    109

    How to copy cells to same place but in another document?

    Hi guys

    I need a script

    that copy for example colorIndex=23(blue) cell form one document to another document on the same place ?

    the script need to check so its exact on the same place

    Could someone help me out?

    Thank you in advance.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: How to copy cells to same place but in another document?

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  3. #3
    Forum Contributor
    Join Date
    02-23-2015
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    109

    Re: How to copy cells to same place but in another document?

    I made this code so far.

    the problem is I need to specify sheet I want the script to check for the sheetname in the filename of the target file the script compare.
    also if there is a certain cell copy and paste.

    Sub copybetween()



    Dim myPath As String
    myPath = Application.GetOpenFilename
    If myPath = "False" Then Exit Sub
    Dim TargetBook As Excel.Workbook
    Dim TargetSheet As Excel.Worksheet
    Dim xlThisSheet As Excel.Worksheet
    Set TargetBook = Workbooks.Open(myPath)
    Set TargetSheet = TargetBook.Worksheets("jeeves")
    Set xlThisSheet = ThisWorkbook.Worksheets("jeeves")
    TargetSheet.Range("C3").Copy
    xlThisSheet.Range("C3").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    TargetBook.Close

    End Sub

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: How to copy cells to same place but in another document?

    You can edit you post to add code tags,
    CodeTags.jpg

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy filtered cells and paste them in the same place - Header error
    By vpestana in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-31-2014, 10:56 AM
  2. Hyperlink problem:'Place in this document'
    By twobits in forum Excel General
    Replies: 1
    Last Post: 05-10-2010, 09:37 PM
  3. get data for one cell and place in another document
    By davidlip in forum Excel General
    Replies: 1
    Last Post: 10-16-2009, 08:25 PM
  4. Macro for Hyperlinking to a place within the document
    By mania112 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2009, 07:01 PM
  5. Link to a special place in another document
    By sura in forum Excel General
    Replies: 4
    Last Post: 05-09-2007, 07:34 PM

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