Avvio macro con evento change
Hai un problema con Excel?
Avvio macro- evento change di
Apoben64 |
Ciao a tutti, includo questo post per integare
altri post che più o meno hanno parlato dell'avvio di macro
sfruttando l'evento change del foglio, sopratutto in presenza di
celle con risultati da formule. questa macro fà uso di costanti.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim rng2 As Range
Const myVal As Long = 1
Const myVal2 As Variant = "pippo"
Set rng = Me.Range("a1")
Set rng2 = Me.Range("d1")
If Not Intersect(rng, Target) Is Nothing Then
On Error GoTo 10
Application.EnableEvents = False
With Me.Range("d1")
If rng.Value = myVal Then
.Value = myVal2
Else
.Value = ""
End If
End With
End If
10:
Application.EnableEvents = True
End Sub
| |
|
|
Vuoi approfondire questo argomento?