when hyperlink pressed can I copy and past the followed cell coten

  • Thread starter Thread starter Rofaiel
  • Start date Start date
R

Rofaiel

My problem is that I have some goods photo whenever you click a picture it
takes you to another worksheet with Item No. and desc. and price, what I need
to do is when I click an item no. it copy the item no, desc, price to a new
worksheet or new workbook.

Thanks in advance for any help
 
You need a worksheet_doubleclick event that will do this
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.
 
Assuming Item number is in Column A. Copy the code below to the worksheet
with Item number, description and price.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim lr As Long, sh As Worksheet, rng As Range
Set sh = ActiveSheet
'Get last row with data in col A
lr = sh.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = sh.Range("A2:A" & lr)
If Not Intersect(Target, rng) Is Nothing Then
Set Newsh = Sheets.Add
ThisWorkbook.Save
sh.Range("A" & Target.Row & ":C" & Target.Row).Copy
ActiveSheet.Range("A" & ActiveSheet.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1).Row).PasteSpecial Paste:=xlValues
'You can put a sheet name in quotes beloow and drow the rest.
Newsh.Name = "Sheet" & Sheets.Count
End If
End Sub

If this does not do what you want, then Don's offer is probably your best
bet.
 
Back
Top