Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim ur As Long, cella As Range ur = Cells(Rows.Count, "n").End(xlUp).Row If Not Intersect(Target, Range("h2:h10")) Is Nothing Then For Each cella In Worksheets("Deposito GOMME").Range("n2:n" & ur) If cella.Value = "Resina" Then Cells(cella.Row, "j").Value = "depositare" End If Next cella End If End Sub
tanimon, 07/12/2020 17:42:Ciao, rimuovi le connessioni dati o verificane le propietà rispondo solo per il quesito posto, e pertanto ho eliminato l'altro codice sugli eventi del foglio. gurda l'allegato. ciao Frank vbPrivate Sub Worksheet_SelectionChange(ByVal Target As Range) Dim ur As Long, cella As Range ur = Cells(Rows.Count, "n").End(xlUp).Row If Not Intersect(Target, Range("h2:h10")) Is Nothing Then For Each cella In Worksheets("Deposito GOMME").Range("n2:n" & ur) If cella.Value = "Resina" Then Cells(cella.Row, "j").Value = "depositare" End If Next cella End If End Sub
Massimo CP, 07/12/2020 18:00: Grazie mille funziona ma servirebbe una modifica se nella colonna H inserisco "montate inv" e se nella colonna N è presente "resina" allora mi deve inserire nella colonna J "depositare" Grazie ancora
target.value
tanimon, 07/12/2020 18:09: ciao puoi usare vbtarget.value con un if Then, prima del for Each, tagliando ed incollando il codice sull'evento Worksheet_Change N.B. "Resina" è diverso da "resina" prova, sono certo che ce la puoi fare ciao Frank
Massimo CP, 07/12/2020 18:20: ci ho provato: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim ur As Long, cella As Range ur = Cells(Rows.Count, "n").End(xlUp).Row If Not Intersect(Target, Range("h2:h1900")) Is Nothing Then If Target.Value Then ' prova For Each cella In Worksheets("Deposito GOMME").Range("n2:n" & ur) If cella.Value = "Resina" Then Cells(cella.Row, "j").Value = "depositare" End If Next cella End If End If End Sub OVVIAMENTE non funziona!
If Target.Value Then
If Target.Value = "MONTATE INV" Then
tanimon, 07/12/2020 18:31: correggi vbIf Target.Value Then con questa vbIf Target.Value = "MONTATE INV" Then
darionardella, 14/12/2020 14:54:Buongiorno, il messaggio compare perchè tutti i calcoli previsti non sono stati effettuati. Sicuramente è disabilitato il calcolo automatico. Se ci sono formule sul foglio, e sono tante, l'aggiornamento di una cella coinvolta nelle formule può rallentare molto l'elaborazione. Se gestisci i calcoli da VBA allora sarebbe preferibile eliinare del tutto le formule e aggiornare tutto da VBA. Allega il file usato e possiamo essere più precisi. Dario