maabadi
Well-known Member
- Joined
- Oct 22, 2012
- Messages
- 2,681
- Office Version
- 2019
- 2016
- Platform
- Windows
Hi Guys?
I see error 13 (type mismatch) when Use this worksheet change event at line Hyperlink? What is Problem?
I see error 13 (type mismatch) when Use this worksheet change event at line Hyperlink? What is Problem?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long, j As Long, Lr1 As Long, Lr2 As Long, Cr1 As Long, Cr1R As Range
Lr1 = Range("A" & Rows.Count).End(xlUp).Row - 1
Lr2 = Range("N" & Rows.Count).End(xlUp).Row - 1
Cr1 = Application.WorksheetFunction.Match(Range("A" & Lr1), Sheets("Sheet1").Range("A1:A" & Lr1), 0)
Set Cr1R = Sheets("sheet1").Range("A" & Cr1)
If Not Intersect(Target, Range("A" & Lr1)) Is Nothing Then
If Target.Count = 1 Then
Application.EnableEvents = False
Range("B" & Lr1 - 1 & ":D" & Lr1 - 1).AutoFill Destination:=Range("B" & Lr1 - 1 & ":D" & Lr1)
Sheets("sheet2").Hyperlinks.Add Anchor:=Range("A" & Lr1).Value, Address:="", SubAddress:=Cr1R, TextToDisplay:=Range("A" & Lr1).Value
Application.EnableEvents = True
End If
End If
End Sub