Results 1 to 13 of 13

Thread: [RESOLVED] Excel - Copy value of cell paste into another cell

  1. #1
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Resolved [RESOLVED] Excel - Copy value of cell paste into another cell

    Hi All,

    Does anyone know if it possible to copy a cell value from the same row the link is on a paste it in another cell on another sheet.

    I.e Values are in Column A and the link would be in Column B and copy to sheet 2 cell A1

    Sheet 1

    Col A ----- Col B
    1212 ----- Click Here < would copy 1212 to sheet 2 cell A1
    7474 ----- Click Here < would copy 7474 to sheet 2 cell A1
    2939 ----- Click Here < would copy 2939 to sheet 2 cell A1

    The cell "a1" on sheet 2 must remain formula free

    I have got about 40 of these rows that need this type of link and the data in Col A changes everyday.

    I hope this makes sense

    Thanks in advance

    Crampz

  2. #2
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: Excel - Copy value of cell paste into another cell

    Paste this in the worksheet code area

    Code:
    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
        If Range(Target.Range.Address).Column = 2 Then
            Sheets("Sheet2").Range("A1").Value = Target.Range.Offset(, -1).Value
        End If
    End Sub
    Last edited by koolsid; Jul 22nd, 2012 at 07:42 AM. Reason: amended code to copy only value
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  3. #3
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 07
    Location
    India
    Posts
    2,156

    Re: Excel - Copy value of cell paste into another cell

    what do u hav in Col B?
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  4. #4
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Re: Excel - Copy value of cell paste into another cell

    Quote Originally Posted by seenu_1st View Post
    what do u hav in Col B?
    I was hoping to be a text link saying "Click Here" which when clicked would copy what is in the cell on the same row in Col A to the sheet 2.

  5. #5
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: Excel - Copy value of cell paste into another cell

    Did you try the code that I gave above? It does what you want
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  6. #6
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Re: Excel - Copy value of cell paste into another cell

    Quote Originally Posted by koolsid View Post
    Did you try the code that I gave above? It does what you want
    Hi Yes Sorry i have pasted this code into the VB worksheet. Where do i go from here? doesnt seem to do anything. Unless im missing something which is about right for me

  7. #7
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: Excel - Copy value of cell paste into another cell

    See the snapshot.

    Once you have pasted the code, simply click on any link in Column 2.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by koolsid; Jul 22nd, 2012 at 08:19 AM. Reason: Sample zip now contains 2003/2007/2010 versions
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  8. #8
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 07
    Location
    India
    Posts
    2,156

    Re: Excel - Copy value of cell paste into another cell

    Quote Originally Posted by crampz View Post
    I was hoping to be a text link saying "Click Here" which when clicked would copy what is in the cell on the same row in Col A to the sheet 2.
    whenever u change any row value in sheet1 Col A, u need that changed row value to be pasted in sheet2 A1, am i right? if yes then why dont u use Worksheet_Change event?
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  9. #9
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: Excel - Copy value of cell paste into another cell

    Seenu, the user wants to copy the cell in Col A if a link is clicked in Col 2. See the sample that I have uploaded above
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  10. #10
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 07
    Location
    India
    Posts
    2,156

    Re: Excel - Copy value of cell paste into another cell

    i hav only 2003 version, can u pls atach 2003 version pls?
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  11. #11
    Hyperactive Member
    Join Date
    Dec 06
    Posts
    264

    Re: Excel - Copy value of cell paste into another cell

    Quote Originally Posted by koolsid View Post
    Seenu, the user wants to copy the cell in Col A if a link is clicked in Col 2. See the sample that I have uploaded above
    Quote Originally Posted by koolsid View Post
    See the snapshot.

    Once you have pasted the code, simply click on any link in Column 2.

    Thank you i had a blonde moment and figured out that yeah you put a hyperlink in to the cell. Thank you for the sample as well.

    You have been a Great help

  12. #12
    Super Moderator koolsid's Avatar
    Join Date
    Feb 05
    Location
    Mumbai, India
    Posts
    11,449

    Re: [RESOLVED] Excel - Copy value of cell paste into another cell

    @Seenu: Updated the Sample.Zip with 2003 version.
    @crampz: Glad to be of help
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - Till Date IMP Links : Acceptable Use Policy, FAQ

    MyGear:
    Sony VGN-FZ27G with a triple boot between (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008) and (Win7+Office 2010+VS2010) || Sony VPCCB-45FN with a Win7+Office 2010+VS2010. VM: (XP+Office 2003+VB6), (VISTA+Office 2007+VS2008), (Win8+Office 2010+VS2012) || Mac Book Pro (10.6.8) with Office 2011

  13. #13
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 07
    Location
    India
    Posts
    2,156

    Re: [RESOLVED] Excel - Copy value of cell paste into another cell

    Thank u sidhu!
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


Posting Permissions

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