
Private Sub ToggleButton1_Click()
togglebuttonclick 1
End Sub
Private Sub ToggleButton2_Click()
togglebuttonclick 2
End Sub
Private Sub ToggleButton3_Click()
togglebuttonclick 3
End Sub
'e così via per tutti gli altri eventi click
private sub togglebuttonclick(n as integer)
dim i as integer
TextBox1.Value = ""
TextBox1.Enabled = False
for i = 1 to 20
controls("ToggleButton" & i).Value = False
next
controls("ToggleButton" & n).Value = true
end sub |
Private Sub ToggleButton1_Click()
togglebuttonclick 1
End Sub
'codice dell'userform
Option Explicit
Private Sub ToggleButton1_Click()
SetExclusive ActiveControl
End Sub
Private Sub ToggleButton2_Click()
SetExclusive ActiveControl
End Sub
Private Sub ToggleButton3_Click()
SetExclusive ActiveControl
End Sub
Private Sub ToggleButton4_Click()
SetExclusive ActiveControl
End Sub
Private Sub ToggleButton5_Click()
SetExclusive ActiveControl
End Sub
Sub SetExclusive(ByRef TglBtn As MSForms.ToggleButton)
Dim ctl As Control
For Each ctl In Controls
If TypeName(ctl) = "ToggleButton" Then
If ctl.Name <> TglBtn.Name Then ctl.Value = False
End If
Next ctl
End Sub |
Private Sub CommandButton4_Click()
'MODIFICA CONTATTO
Load UserForm2
With UserForm2
.ComboBox1 = Cells(ActiveCell.Row, "A")
.TextBox1 = Cells(ActiveCell.Row, "B")
.TextBox2 = Cells(ActiveCell.Row, "C")
.ComboBox2 = Cells(ActiveCell.Row, "D")
.TextBox3 = Cells(ActiveCell.Row, "E")
.TextBox4 = Cells(ActiveCell.Row, "F")
.TextBox5 = Cells(ActiveCell.Row, "H")
.TextBox6 = Cells(ActiveCell.Row, "G")
.Show
End With
End Sub |
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.Intersect(Target, Range("A:H")) Is Nothing Then Exit Sub
If Target.Row < 3 Then Exit Sub
If Selection.Count = 1 And Target.Row > 2 Then
If Range("Z1") = "" Then Range("Z1") = ActiveCell.Row
Range(Cells(ActiveCell.Row, "A"), Cells(ActiveCell.Row, "H")).Interior.ColorIndex = 36
If Range("Z1") <> Target.Row Then Rows(Range("Z1")).Interior.ColorIndex = xlNone
Range("Z1") = Target.Row
End If
End Sub |
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Selection.Count = 1 And Target.Row > 2 Then With ActiveCell Range(.EntireRow.Cells(1, 1), .EntireRow.Cells(1, 8)).Interior.ColorIndex = 36 End With On Error Resume Next If [Z1] <> Target.Row Then _ Rows([Z1]).Interior.ColorIndex = xlNone [Z1] = Target.Row End If End Sub |
If [Z1] <> Target.Row Then _
Range(Cells([Z1], "A"), Cells([Z1], "H")).Interior.ColorIndex = 35
