dodonohoe
01-14-2014, 03:23 AM
I have the following code which inserts a signature once a specified cell range is activated. This works fine but once I switch between worsheets using hyperlinks it throws the error "Method Intersect of Object_Global failed". I have the code pasted into the worksheet where the signatures go. I can switch between worksheets without issue but if I click on a hyperlink which I need) to bring me to another worksheet in the same workbook I get the error. I have marked within the code where the debugger brings me.
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set Target = Me.Range("C2:D18")
'ERROR is here
If Not Intersect(ActiveCell, Target) Is Nothing Then
signature
End If
End Sub
Sub signature()
Dim user1 As String
Dim date1 As Date
'Sheets("Checklist").Select
'If Trim(Cells(2, 3)) = "" Then
If ActiveCell = "" Then
user1 = Environ("UserName")
date1 = Now
ActiveCell = user1 & " @ " & date1
End If
End Sub
Many thanks,
Des
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set Target = Me.Range("C2:D18")
'ERROR is here
If Not Intersect(ActiveCell, Target) Is Nothing Then
signature
End If
End Sub
Sub signature()
Dim user1 As String
Dim date1 As Date
'Sheets("Checklist").Select
'If Trim(Cells(2, 3)) = "" Then
If ActiveCell = "" Then
user1 = Environ("UserName")
date1 = Now
ActiveCell = user1 & " @ " & date1
End If
End Sub
Many thanks,
Des