Mettre boucle for dans condition if VBA
Jack
-
vordano Messages postés 1981 Statut Membre -
vordano Messages postés 1981 Statut Membre -
Bonjour,
Je voudrais savoir s'il était possible de mettre un boucle for dans une condition if, par exemple:
if UBound(tab_bd)>0 and
for c=0 to UBound(tab_bd)
cells(tab_bd(c),6)=cells(tab_bd(0),6)
cells(tab_bd(c),7)=cells(tab_bd(0),7)
cells(tab_bd(c),8)=cells(tab_bd(0),8)
then
msgbox("ok")
end if
Pour l'instant ça ne marche pas...
Merci d'avance à ceux qui pourront m'éclairer sur ce point.
Je voudrais savoir s'il était possible de mettre un boucle for dans une condition if, par exemple:
if UBound(tab_bd)>0 and
for c=0 to UBound(tab_bd)
cells(tab_bd(c),6)=cells(tab_bd(0),6)
cells(tab_bd(c),7)=cells(tab_bd(0),7)
cells(tab_bd(c),8)=cells(tab_bd(0),8)
then
msgbox("ok")
end if
Pour l'instant ça ne marche pas...
Merci d'avance à ceux qui pourront m'éclairer sur ce point.
A voir également:
- If for vba
- Downloader for pc - Télécharger - Téléchargement & Transfert
- Idm for mac - Télécharger - Téléchargement & Transfert
- Instagram for pc - Télécharger - Divers Communication
- Incompatibilité de type vba ✓ - Forum Programmation
- Microsoft store download for pc - Guide
16 réponses
Bonjour,
On ne vout pas trop ce que tu cherches à faire ..
Essaie ça :
dim bTrouvé as boolean ;
bTrouvé = false ;
if UBound(tab_bd)>0 then
for c=0 to UBound(tab_bd)
if cells(tab_bd(c),6)=cells(tab_bd(0),6) and
cells(tab_bd(c),7)=cells(tab_bd(0),7) and
cells(tab_bd(c),8)=cells(tab_bd(0),8) then
bTrouvé = true ;
exit for ;
next ;
end if ;
if bTrouvé then msgbox("OK") ;
cdlt
On ne vout pas trop ce que tu cherches à faire ..
Essaie ça :
dim bTrouvé as boolean ;
bTrouvé = false ;
if UBound(tab_bd)>0 then
for c=0 to UBound(tab_bd)
if cells(tab_bd(c),6)=cells(tab_bd(0),6) and
cells(tab_bd(c),7)=cells(tab_bd(0),7) and
cells(tab_bd(c),8)=cells(tab_bd(0),8) then
bTrouvé = true ;
exit for ;
next ;
end if ;
if bTrouvé then msgbox("OK") ;
cdlt