
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Indirizzo
If Target.Count > 1 Then Exit Sub
Indirizzo = Target.Value
Select Case Indirizzo
Case "GIALLO", "VERDE", "ROSSO", "VIOLA", "ARANCIO", "BIANCO"
ActiveCell.Offset(0, 1).Value = "+"
Case Else
ActiveCell.Offset(0, 1).Value = "-"
End Select
End Sub |
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Range("D:D")
With Target
If Target.Count > 1 Then Exit Sub
If Not Intersect(rng, .Cells) Is Nothing Then
Select Case Target
Case "GIALLO", "VERDE", "ROSSO", "VIOLA", "ARANCIO", "BIANCO"
ActiveCell.Offset(-1, 1).Value = "+"
Case Else
ActiveCell.Offset(-1, 1).Value = "-"
End Select
End If
End With
End Sub |
Private Sub Worksheet_Change(ByVal Target As Range)
'dichiato le variabili
Dim lng As Long
Dim v As Variant
Dim lUltRiga As Long
Dim sh As Worksheet
Dim sh2 As Worksheet
Dim lCont As Long
Dim sCella As String
Dim rng As Range
Set rng = Range("A:A")
With Target
If Target.Count > 1 Then Exit Sub
If Not Intersect(rng, .Cells) Is Nothing Then
10 Set sh = ThisWorkbook.Worksheets("Foglio1")
20 Set sh2 = ThisWorkbook.Worksheets("Foglio2")
30 With sh
40 v = Target
50 If v = False Then Exit Sub
60 End With
70 With sh2
80 lUltRiga = .Range("A" & .Rows.Count).End(xlUp).Row
100 lCont = 1
110 On Error Resume Next
120 For lng = 1 To lUltRiga
130 If .Cells(lng, 1).Value = v Then
140 sCella = .Cells(lng, 1).Text
150 Exit For
170 End If
180 lCont = lCont + 1
190 Next
290 End With
300 sh.Select
310 If sCella = "" Then
320 ActiveCell.Offset(-1, 1).Value = "-"
330 Else
340 ActiveCell.Offset(-1, 1).Value = "+"
350 End If
360 Set sh = Nothing
End If
End With
End Sub
|
