Sub Inserite attualmente
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Dim Segno As String
Private Sub Worksheet_SelectionChange(ByVal target As Range)
If Intersect(target, Range("B10:C18")) Is Nothing Then
Call NascondePulsanti
Rows("3:3").EntireRow.Hidden = True
Else
Rows("3:3").EntireRow.Hidden = False
Call ScoprePulsanti
End If
End Sub
Sub Somma()
Segno = "+"
Range("L5") = Segno
Range("M5") = ""
End Sub
Sub Sottrae()
Segno = "-"
Range("L5") = ""
Range("M5") = Segno
End Sub
Sub Cinque()
Dim Ncella As String
Ncella = ActiveCell.Address
If Intersect(Range(Ncella), Range("B10:C18")) Is Nothing Then Exit Sub
If Segno = "+" Then
Range(Ncella) = Range(Ncella) + 5
Else
Range(Ncella) = Range(Ncella) - 5
End If
End Sub
Sub Dieci()
Dim Ncella As String
Ncella = ActiveCell.Address
If Intersect(Range(Ncella), Range("B10:C18")) Is Nothing Then Exit Sub
If Segno = "+" Then
Range(Ncella) = Range(Ncella) + 10
Else
Range(Ncella) = Range(Ncella) - 10
End If
End Sub
Sub Venti()
Dim Ncella As String
Ncella = ActiveCell.Address
If Intersect(Range(Ncella), Range("B10:C18")) Is Nothing Then Exit Sub
If Segno = "+" Then
Range(Ncella) = Range(Ncella) + 20
Else
Range(Ncella) = Range(Ncella) - 20
End If
End Sub
Sub Cinquanta()
Dim Ncella As String
Ncella = ActiveCell.Address
If Intersect(Range(Ncella), Range("B10:C18")) Is Nothing Then Exit Sub
If Segno = "+" Then
Range(Ncella) = Range(Ncella) + 50
Else
Range(Ncella) = Range(Ncella) - 50
End If
End Sub
Sub Cento()
Dim Ncella As String
Ncella = ActiveCell.Address
If Intersect(Range(Ncella), Range("B10:C18")) Is Nothing Then Exit Sub
If Segno = "+" Then
Range(Ncella) = Range(Ncella) + 100
Else
Range(Ncella) = Range(Ncella) - 100
End If
End Sub
Sub Duecento()
Dim Ncella As String
Ncella = ActiveCell.Address
If Intersect(Range(Ncella), Range("B10:C18")) Is Nothing Then Exit Sub
If Segno = "+" Then
Range(Ncella) = Range(Ncella) + 200
Else
Range(Ncella) = Range(Ncella) - 200
End If
End Sub
Sub Cinquecento()
Dim Ncella As String
Ncella = ActiveCell.Address
If Intersect(Range(Ncella), Range("B10:C18")) Is Nothing Then Exit Sub
If Segno = "+" Then
Range(Ncella) = Range(Ncella) + 500
Else
Range(Ncella) = Range(Ncella) - 500
End If
End Sub
Sub NascondePulsanti()
Dim NomPul As String
Dim i As Long
On Error Resume Next
For i = 1 To 15
NomPul = "Pulsante " & i
Buttons(NomPul).Visible = False
Next i
End Sub
Sub ScoprePulsanti()
Dim NomPul As String
Dim i As Long
On Error Resume Next
For i = 1 To 15
NomPul = "Pulsante " & i
Buttons(NomPul).Visible = True
Next i
End Sub
|