|
-
Jul 22nd, 2012, 07:13 AM
#1
Thread Starter
Hyperactive Member
[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
-
Jul 22nd, 2012, 07:34 AM
#2
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
-
Jul 22nd, 2012, 07:55 AM
#3
Re: Excel - Copy value of cell paste into another cell
-
Jul 22nd, 2012, 08:01 AM
#4
Thread Starter
Hyperactive Member
Re: Excel - Copy value of cell paste into another cell
 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.
-
Jul 22nd, 2012, 08:04 AM
#5
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
-
Jul 22nd, 2012, 08:05 AM
#6
Thread Starter
Hyperactive Member
Re: Excel - Copy value of cell paste into another cell
 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
-
Jul 22nd, 2012, 08:10 AM
#7
-
Jul 22nd, 2012, 08:12 AM
#8
Re: Excel - Copy value of cell paste into another cell
 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?
-
Jul 22nd, 2012, 08:13 AM
#9
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
-
Jul 22nd, 2012, 08:17 AM
#10
Re: Excel - Copy value of cell paste into another cell
i hav only 2003 version, can u pls atach 2003 version pls?
-
Jul 22nd, 2012, 08:19 AM
#11
Thread Starter
Hyperactive Member
Re: Excel - Copy value of cell paste into another cell
 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
 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
-
Jul 22nd, 2012, 08:20 AM
#12
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
-
Jul 22nd, 2012, 08:26 AM
#13
Re: [RESOLVED] Excel - Copy value of cell paste into another cell
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|