'''''''''''''''''
'BIRTHDATE CODE '
'''''''''''''''''
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("J1:J300")) Is Nothing Then
Application.EnableEvents = False
With Target
If IsDate(.Text) And .Cells.Count = 1 Then
.Value = DateDiff("yyyy", .Value, Date)
[COLOR=#00ff00].NumberFormat = "@"[/COLOR] ''here is the problem ("Runtime error 1004: Unable to set the number of the property of the range class")
End If
End With
Application.EnableEvents = True
End If
''''''''''''''''''''''''''''''
'"if" CODE AUTONUMBER COLOUMN'
''''''''''''''''''''''''''''''
If Intersect(Target, Range("E5:E300,M5:M300,D5:T300")) Is Nothing Then Exit Sub
On Error Resume Next
Application.EnableEvents = False
Application.Calculation = xlManual
If Target.Column = 5 Then
Dim i As Long
Range("D5:D300").ClearContents
For i = 5 To Cells(Rows.Count, 5).End(xlUp).Row
Cells(i, 4).FormulaR1C1 = "=IF(RC[1]="""","""",SUBTOTAL(3,R5C5:RC[1]))"
Next i
End If
If Target.Column = 11 Then
'Dim i As Long
Dim b As Integer
Dim c As Range
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For Each c In Range("K5:K300")
For b = 1 To Lastrow
If c.Value = Cells(b, 1).Value Then c.Value = Cells(b, 2).Value
Next
Next
End If
''''''''''''''''''''''''''
'Autofit + UpperCase CODE'
''''''''''''''''''''''''''
If Target.Column >= 4 And Target.Column <= 12 Then
If Target.Cells.Count > 1 Or Target.HasFormula Then ''interpretazione da controllare
Application.Calculation = xlAutomatic
Calculate
Application.EnableEvents = True
Exit Sub
End If
Target = UCase(Target)
Sheets("List").Columns("D:T").AutoFit
End If
Application.Calculation = xlAutomatic
Calculate
Application.EnableEvents = True
End Sub
'''''''''''''''''''
'HYPERLINK CODE '
'''''''''''''''''''
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column <> 14 Then Exit Sub
Dim rngFound As Range
With Worksheets("Respons.").Columns(5) 'Guarda in quale colonna cercare
Set rngFound = .Find(Target.Offset(0, -6).Value, LookIn:=xlValues, LookAt:=xlWhole, After:=.Cells(1), Searchdirection:=xlNext)
If Not rngFound Is Nothing Then
Application.Goto rngFound(1, Target.Value + 1)
Else
MsgBox "There were not matches found for " & Target(1, -5).Value
End If
End With
Cancel = True
End Sub