- Codice: Seleziona tutto
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
UR = Range("A" & Rows.Count).End(xlUp).Row
CheckArea = "A3:A100" & UR
Areas = "V1"
Dim Vs(50) As Integer
Dim Vr(50) As Integer
If Not Application.Intersect(ActiveCell, Range(CheckArea)) Is Nothing Then
If (Selection.Rows.Count + Selection.Columns.Count) > 2 Then Exit Sub
Application.EnableEvents = False
If Selection.Value <> 0 Then
Selection.ClearContents
Else
For Cs = 2 To UR
If Mid(Range("A" & Cs).Value, 1, 1) = "S" Then
NS = Val(Replace(Range("A" & Cs).Value, "S", ""))
Vs(NS) = NS
Else
NR = Val(Replace(Range("A" & Cs).Value, "R", ""))
Vr(NR) = NR
End If
Next Cs
For VV = 1 To 50
If [V1] = "S" Then
If Vs(VV) = 0 Then
Vs(VV) = VV
GoTo SaltaS
End If
Else
If Vr(VV) = 0 Then
Vr(VV) = VV
GoTo SaltaS
End If
End If
Next VV
SaltaS:
Selection.Value = [V1] & VV
End If
End If
SaltaA:
If Not Application.Intersect(ActiveCell, Range(Areas)) Is Nothing Then
If (Selection.Rows.Count + Selection.Columns.Count) > 2 Then Exit Sub
Application.EnableEvents = False
If Selection.Value = "S" Then
[V1] = "R"
Else
[V1] = "S"
End If
ActiveCell.Offset(0, -1).Select
End If
Application.EnableEvents = True
End Sub
La modifica che mi serve è praticamente senza la lettera davanti al numero, praticamente inserire dei numeri progressivi con un click, questa modifica mi serve per compilare una distinta per calciatori, quindi la numerazione deve essere fino a 20 o posso indicare io il numero massimo da inserire e chiaramente senza doppioni, il codice di Flash fa tutto questo però non riesco a modificarlo.
Spero di essere stato chiaro, un saluto a tutti e buona giornata.