![]() |
|
Forum
|
|
|
#1 (permalink) |
|
Guest
Messages: n/a
|
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] |
|
| ANNONCES | |||
|
|
|
|
#2 (permalink) |
|
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
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
__________________
« Connaître son ignorance est la meilleure part de la connaissance. » ![]() |
|
|
|
|
|
#3 (permalink) |
|
Guest
Messages: n/a
|
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 |
|
|
| ANNONCES | |
![]() |
| Liens sociaux |
| Outils de la discussion | |
|
|