| | Post: 10 | Registrato il: 27/02/2017
| Utente Junior | 2013 | | OFFLINE | |
|
06/04/2017 14:18 | |
Buongiorno a tutti, sono alle prese con un codice vba sino ad ora ha vinto lui, vorrei chiedere il vostro aiuto in quanto io, forse perchè ci sto dietro da questa mattina, sono leggermente fuso, ho creato un pulsante che mi va a resettare o per meglio dire mi riporta al colore rosso un'altro pulsante, fin qui tutto ok, io onde evitare errori vorrei che il comando associato al pulsante venga protetto da password, quindi quando clicco su di esso mi venga richiesta la password e se inserita errata non venga effettuata nessuna operazione, io ho fatto questo ma se inserisco password sbagliata mi esegue lo stesso il comando. GRAZIE.
Private Sub CommandButton32_Click()
Dim pass As Variant
pass = InputBox("inserisci password")
If pass <> "1" Then
MsgBox "azione riservata all'amministratore"
Else
MsgBox "tue istruzioni"
End If
If Worksheets("Aprile").CommandButton3.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton3.BackColor = &HFF&
Else
End If
If Worksheets("Aprile").CommandButton2.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton2.BackColor = &HFF&
Else
End If
If Worksheets("Aprile").CommandButton4.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton4.BackColor = &HFF&
Else
End If
If Worksheets("Aprile").CommandButton5.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton5.BackColor = &HFF&
Else
End If
If Worksheets("Aprile").CommandButton6.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton6.BackColor = &HFF&
Else
End If
If Worksheets("Aprile").CommandButton1.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton1.BackColor = &HFF&
Else
End If
If Worksheets("Aprile").CommandButton7.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton7.BackColor = &HFF&
Else
End If
If Worksheets("Aprile").CommandButton8.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton8.BackColor = &HFF&
Else
End If
If Worksheets("Aprile").CommandButton9.BackColor = &HC000& Then
Worksheets("Aprile").CommandButton9.BackColor = &HFF&
Else
End If
End Sub |
|
| | Post: 5.112 | Registrato il: 14/11/2004
| Utente Master | Office 2019 | | OFFLINE |
|
06/04/2017 14:24 | |
Ciao sotto questa riga, aggiungi Exit Sub
MsgBox "azione riservata all'amministratore"
Exit Sub
Ciao by Sal
[Modificato da by sal 06/04/2017 14:26] se ti piace la soluzione sostienici con una DONAZIONE a piacere. Grazie clicca qui |
| | Post: 10 | Registrato il: 27/02/2017
| Utente Junior | 2013 | | OFFLINE | |
|
06/04/2017 14:34 | |
Grazie mille By Sal,mi son perso in un bicchiere d'acqua e tu mi hai salvato, problema risolto alla grane. Ancora grazie per l'aiuto. |
|
|