[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
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
Re: Excel - Copy value of cell paste into another cell
Re: Excel - Copy value of cell paste into another cell
Quote:
Originally Posted by
seenu_1st
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.
Re: Excel - Copy value of cell paste into another cell
Did you try the code that I gave above? It does what you want
Re: Excel - Copy value of cell paste into another cell
Quote:
Originally Posted by
koolsid
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 :D
2 Attachment(s)
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.
Re: Excel - Copy value of cell paste into another cell
Quote:
Originally Posted by
crampz
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?
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
Re: Excel - Copy value of cell paste into another cell
i hav only 2003 version, can u pls atach 2003 version pls?
Re: Excel - Copy value of cell paste into another cell
Quote:
Originally Posted by
koolsid
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
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 :D
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 :)
Re: [RESOLVED] Excel - Copy value of cell paste into another cell