Results 1 to 13 of 13

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

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Posts
    293

    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
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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 Siddharth Rout; 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


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

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

    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

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Posts
    293

    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
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Posts
    293

    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
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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 Siddharth Rout; 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


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

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

    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
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

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

    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

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2006
    Posts
    293

    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
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

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

    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
  •  



Click Here to Expand Forum to Full Width