Ask Experts Questions for FREE Help !
Ask
    susimoon's Avatar
    susimoon Posts: 2, Reputation: 1
    New Member
     
    #1

    Feb 20, 2011, 02:46 AM
    I want to show in cell the d8 the date which cell a8 hyperlink was last opened
    I have a hyperlink in cell a8. When someone uses this hyperlink I want cell d8 to show the date it was last accessed. In cell e8 I want to show a date two years on from the date in cell d8.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #2

    Feb 20, 2011, 07:05 AM

    This would require VBA. Is that OK?

    Constructing a macro like this is pretty straightforward. But you do have to know if this if for A8 only, or for a bunch of cells in column A starting at A8 and going down some distance.

    For instance:
    Code:
    Cell	Date	Future Date
    A8	E8	D8
    A9	E9	D9
    A10	E10	D10
    etc....

    Here's a macro to work A8 only, pretty simple:
    Code:
    Option Explicit
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
        
    If Target.Address = "$A$8" Then
        [E8] = Date
        [D8] = DateValue(Year(Date) + 2 & "-" & Month(Date) & "-" & Day(Date))
    End If
        
    
    End Sub


    Here's a macro for anywhere in column A where you click on a cell and it has a hyperlink:
    Code:
    Option Explicit
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim HLink As Hyperlink
    If Target.Cells.Count > 1 Then Exit Sub
    
    If Target.Column = 1 Then
        On Error Resume Next
        Set HLink = Target.Hyperlinks(1)
        If Not HLink Is Nothing Then
            Application.EnableEvents = False
            Range("E" & Target.Row) = Date
            Range("D" & Target.Row) = DateValue(Year(Date) + 2 & "-" & Month(Date) & "-" & Day(Date))
            Application.EnableEvents = True
        End If
    End If
        
    
    End Sub


    Pick on of these and put it into the Sheet module where you want this to occur.

    1) Right-click on the sheet tab
    2) Select View Code
    3) Paste in the code given above
    4) Close the VBeditor
    5) Save your workbook as a macro-enabled workbook
    susimoon's Avatar
    susimoon Posts: 2, Reputation: 1
    New Member
     
    #3

    Feb 20, 2011, 08:16 AM
    Comment on JBeaucaire's post
    Outstanding, thank you very much for your help. I am very very green with Excel and your answer has saved me no end of time. Thank you, thank you. It worked just as I needed it to.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

How to show all the text in an excel cell [ 1 Answers ]

I have noticed in a lot of excel spreadsheet that when I past in text some of it does not show up until I double click the cell I pasted in. sometimes it is in the middle sometimes it happens at the end. I am not exceeding the amount of characters allowed in a cell. The length of the cell is only...

How to is a cell dectected as a infected cell-by virus By the White cells ? [ 2 Answers ]

How to is a cell dectected as a infected cell-by virus By the White cells ?

Date won't return cell phone [ 27 Answers ]

Ok so here is my current dilemma - I went on a date with this guy- first date, and he seems like a great guy, personality,good job, nice car, the whole nine I left my cell in his car - didn't realize until halfway home when it was too late So I aim him and make arrangements for him to drop it...

Solar cell & photo cell [ 6 Answers ]

What is the different between solar cell & photo cell ( photo electric effect exp... ) ?


View more questions Search