AGGIORNAMENTO
Il VBA funziona! Si prega di vedere il codice qui sotto. Ho solo bisogno di aiuto per modificarlo in modo che quando cambio una cella nella colonna I salvi il valore nella colonna H.
Dim xRg come intervallo
Dim xChangeRg come intervallo
Dim xDependRg come intervallo
Dim xDic come nuovo dizionario
Private Sub Worksheet_Change (ByVal Target As Range)
Dim I quanto a lungo
Dim xCell come intervallo
Dim xDCell come intervallo
Dim xHeader come stringa
Dim xCommText come stringa
On Error Resume Next
Application.ScreenUpdating = False
Application.EnableEvents = False
xHeader = "Valore precedente:"
x = xDic.Tasti
Per I = 0 A UBound(xDic.Keys)
Imposta xCell = Range(xDic.Keys(I))
Imposta xDCell = Celle(xCell.Row, 5)
xDCell.Value = ""
xDCella.Valore = xDic.Articoli(I)
Avanti
Se Target.Column = 6 Then
Application.EnableEvents = False
Celle(Target.Row, 7).Valore = Data
Application.EnableEvents = True
End If
Se Target.Column = 9 Then
Application.EnableEvents = False
Celle(Target.Row, 10).Valore = Data
Application.EnableEvents = True
End If
Application.EnableEvents = True
End Sub
Private Sub Worksheet_SelectionChange (ByVal Target As Range)
Dim I, J tanto a lungo
Dim xRgArea come intervallo
In caso di errore GoTo Label1
Se Target.Count > 1 Quindi esci da Sub
Application.EnableEvents = False
Impostare xDependRg = Target.Dependents
Se xDependRg non è niente, vai a Label1
Se non xDependRg non è niente, allora
Imposta xDependRg = Intersect(xDependRg, Range("F:F"))
End If
Etichetta1:
Imposta xRg = Interseca(Obiettivo, Intervallo("F:F"))
If (Not xRg Is Nothing) E (Not xDependRg Is Nothing) Then
Imposta xChangeRg = Union(xRg, xDependRg)
AltrimentiSe (xRg non è niente) E (Non xDependRg non è niente) Allora
Impostare xChangeRg = xDependRg
ElseIf (Not xRg non è niente) E (xDependRg non è niente) Allora
Impostare xCambiaRg = xRg
Altro
Application.EnableEvents = True
Exit Sub
End If
xDic.RimuoviTutto
Per I = 1 A xChangeRg.Areas.Count
Imposta xRgArea = xCambiaRg.Areas(I)
Per J = 1 A xRgArea.Count
xDic.Add xRgArea(J).Indirizzo, xRgArea(J).Formula
Avanti
Avanti
Impostare xChangeRg = Niente
Imposta xRg = Niente
Impostare xDependRg = Niente
Application.EnableEvents = True
End Sub