message d'alerte

  • Initiateur de la discussion jean mi
  • Date de début
J

jean mi

Guest
Bonsoir à tous

J'aimerais avoir un message d'alerte me signalant qu'il manque un prénom en face du nom dans le tableau ci joint lorsque je clic sur retour

merci a tous pour vos réponses

jean michel [file name=msgalert_prenom.zip size=19181]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/msgalert_prenom.zip[/file]
 

Pièces jointes

  • msgalert_prenom.zip
    18.7 KB · Affichages: 20

porcinet82

XLDnaute Barbatruc
Salut Jean mi,

Tiens voici un petit bout de code qui fait ce que tu souhaites :
Code:
Sub Macro1()
Dim i As Integer

For i = 5 To Range('A65536').End(xlUp).Row
    If Cells(i, 2).Value = '' Then
        MsgBox 'Vous avez oublié de taper un prenom', vbExclamation, 'Attention'
        Cells(i, 2).Select
        Exit Sub
    End If
Next i
Sheets('Feuil1').Select
End Sub

Par contre si tu veux que ca fonctionne pour les deux colonnes, utilises celui-ci :
Code:
Sub Macro1_bis()
Dim i As Integer

For i = 5 To Range('A65536').End(xlUp).Row
    If Cells(i, 2).Value = '' Then
        MsgBox 'Vous avez oublié de taper un prenom', vbExclamation, 'Attention'
        Cells(i, 2).Select
        Exit Sub
    End If
Next i
For i = 5 To Range('A65536').End(xlUp).Row
    If Cells(i, 1).Value = '' And Not Cells(i, 2).Value = '' Then
        MsgBox 'Vous avez oublié de taper un nom', vbExclamation, 'Attention'
        Cells(i, 1).Select
        Exit Sub
    End If
Next i
Sheets('Feuil1').Select
End Sub

@+
 
J

jean mi

Guest
MERCI PORCNET 2 pour la reponse c'est ce que je recherché,j'ai employé de la solution 2 avec une petite modif
bonne soiree a tous
Sub Macro1_bis()
Dim i As Integer

For i = 5 To Range('A65536').End(xlUp).Row
If Cells(i, 2).Value = '' And Not Cells(i, 1).Value = '' Then
MsgBox 'Vous avez oublié de taper un prenom', vbExclamation, 'Attention'
Cells(i, 2).Select
Exit Sub
End If
Next i
For i = 5 To Range('B65536').End(xlUp).Row
If Cells(i, 1).Value = '' And Not Cells(i, 2).Value = '' Then
MsgBox 'Vous avez oublié de taper un nom', vbExclamation, 'Attention'
Cells(i, 1).Select
Exit Sub
End If
Next i
Sheets('Feuil1').Select
End Sub
 

Discussions similaires

Statistiques des forums

Discussions
312 520
Messages
2 089 301
Membres
104 092
dernier inscrit
karbone57