ripetere funzione ad ogni click



  • ripetere funzione ad ogni click
    di musicante (utente non iscritto) data: 07/05/2014 11:40:24

    Buongiorno ragazzi, premetto che non so usare Vba, cerco solo in rete di arrangiarmi nella compilazione.
    Ho questo problema , vorrei che ad ogni click nella cella prescelta mi apparisse e no il carattere "-".
    Quindi penso un ciclo di esecuzione o qualcosa del genere.
    Grazie in anticipo.
     
    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    If Not Intersect(Target, Range("c12:n12")) Is Nothing Then
    ActiveCell.FormulaR1C1 = "-"
    Else
    End If
    If Not Intersect(Target, Range("c12:n12")) Is Nothing Then
    ActiveCell.FormulaR1C1 = ""
    Else
    End If
    End Sub
    



  • di scossa data: 07/05/2014 18:05:48

    Vedi sotto:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    If Not Intersect(ActiveCell, Range("c12:n12")) Is Nothing Then
    With ActiveCell
    .Value = IIf(.Value = "-", "", "-")
    End With
    End If
    End Sub


    Alternativa:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    If Not Intersect(ActiveCell, Range("c12:n12")) Is Nothing Then
    With ActiveCell
    .Value = IIf(.Value = "-", "", "-")
    Application.EnableEvents = False
    ActiveCell.Offset(1, 0).Select
    Application.EnableEvents = True
    End With
    End If
    End Sub



    scossa's web site
    Se tu hai una mela, ed io ho una mela, e ce le scambiamo, allora tu ed io abbiamo sempre una mela per uno.
    Ma se tu hai un'idea, ed io ho un'idea, e ce le scambiamo, allora abbiamo entrambi due idee. (George Bernard Shaw)



  • di musicante (utente non iscritto) data: 09/05/2014 10:34:25

    Grazie 1000 scossa, il secondo esempio è perfetto!!!!!