Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Problème d'écriture VBA

11 réponses
Avatar
Didier NOVARIN
Bonsoir,
Je souhaite écrire quelque chose comme cela, mais cela me renvoi une erreur
4..
Je vous remercie
Didier

Sub Test()
Dim cellule As Range
Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row).Value
For Each cellule In Plg
If cellule <> "" Then
cellule.Select
End If
Next
End Sub

10 réponses

1 2
Avatar
francois.forcet
Salut à toi

Il ne faut pas utiliser en tant que variable le Mot cellule qui doit
être une dénomination qu'Excel utilise pour son propre fonctionnement

Utilise plustôt une lettre comme "c"

celà donne :

Dim cellule As Range
Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row).Value
For Each c In Plg
If c <> "" Then
c.Select
End If
Next

Fais un essai et dis moi !!!!
Avatar
Philippe.R
Bonsoir,
Essaye comme ceci :

Sub Test()
Dim cellule As Range
Set Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
For Each cellule In Plg
If cellule.Value <> "" Then
cellule.Select
End If
Next
End Sub
--
Avec plaisir
http://dj.joss.free.fr/trombine.htm
http://jacxl.free.fr/mpfe/trombino.html
Philippe.R
Pour se connecter au forum :
http://www.excelabo.net/mpfe/connexion.php
News://news.microsoft.com/microsoft.public.fr.excel
"Didier NOVARIN" a écrit dans le message
de news:47f3d128$0$21143$
Bonsoir,
Je souhaite écrire quelque chose comme cela, mais cela me renvoi une
erreur 4..
Je vous remercie
Didier

Sub Test()
Dim cellule As Range
Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row).Value
For Each cellule In Plg
If cellule <> "" Then
cellule.Select
End If
Next
End Sub



Avatar
Didier NOVARIN
Bonsoir,
Il plante sur c.Select
Merci quand même
Didier

Sub AA()
Dim cellule As Range
Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row).Value
For Each c In Plg
If c <> "" Then
c.Select
End If
Next
End Sub

a écrit dans le message de news:

Salut à toi

Il ne faut pas utiliser en tant que variable le Mot cellule qui doit
être une dénomination qu'Excel utilise pour son propre fonctionnement

Utilise plustôt une lettre comme "c"

celà donne :

Dim cellule As Range
Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row).Value
For Each c In Plg
If c <> "" Then
c.Select
End If
Next

Fais un essai et dis moi !!!!
Avatar
Didier NOVARIN
Bonsoir Philippe
Là, il me sélectionne que la dernière cellule, en fait, je voudrais que la
procédure sélectionne toute les cellules non vide
Merci
Didier


"Philippe.R" <AS_rauphil_chez_wanadoo.fr> a écrit dans le message de news:

Bonsoir,
Essaye comme ceci :

Sub Test()
Dim cellule As Range
Set Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
For Each cellule In Plg
If cellule.Value <> "" Then
cellule.Select
End If
Next
End Sub
--
Avec plaisir
http://dj.joss.free.fr/trombine.htm
http://jacxl.free.fr/mpfe/trombino.html
Philippe.R
Pour se connecter au forum :
http://www.excelabo.net/mpfe/connexion.php
News://news.microsoft.com/microsoft.public.fr.excel
"Didier NOVARIN" a écrit dans le message
de news:47f3d128$0$21143$
Bonsoir,
Je souhaite écrire quelque chose comme cela, mais cela me renvoi une
erreur 4..
Je vous remercie
Didier

Sub Test()
Dim cellule As Range
Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row).Value
For Each cellule In Plg
If cellule <> "" Then
cellule.Select
End If
Next
End Sub






Avatar
Philippe.R
Re,
Cosi alors :

Sub Test()
Dim c As Range, maplage As String
Set Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
For Each c In Plg
If c.Value <> "" Then
zaza = c.Address
maplage = maplage & IIf(maplage = "", "", ",") & zaza
End If
Next
If maplage <> "" Then Range(maplage).Select
End Sub
--
Avec plaisir
http://dj.joss.free.fr/trombine.htm
http://jacxl.free.fr/mpfe/trombino.html
Philippe.R
Pour se connecter au forum :
http://www.excelabo.net/mpfe/connexion.php
News://news.microsoft.com/microsoft.public.fr.excel
"Didier NOVARIN" a écrit dans le message
de news:47f3d405$0$21142$
Bonsoir Philippe
Là, il me sélectionne que la dernière cellule, en fait, je voudrais que la
procédure sélectionne toute les cellules non vide
Merci
Didier


"Philippe.R" <AS_rauphil_chez_wanadoo.fr> a écrit dans le message de news:

Bonsoir,
Essaye comme ceci :

Sub Test()
Dim cellule As Range
Set Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
For Each cellule In Plg
If cellule.Value <> "" Then
cellule.Select
End If
Next
End Sub
--
Avec plaisir
http://dj.joss.free.fr/trombine.htm
http://jacxl.free.fr/mpfe/trombino.html
Philippe.R
Pour se connecter au forum :
http://www.excelabo.net/mpfe/connexion.php
News://news.microsoft.com/microsoft.public.fr.excel
"Didier NOVARIN" a écrit dans le
message de news:47f3d128$0$21143$
Bonsoir,
Je souhaite écrire quelque chose comme cela, mais cela me renvoi une
erreur 4..
Je vous remercie
Didier

Sub Test()
Dim cellule As Range
Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row).Value
For Each cellule In Plg
If cellule <> "" Then
cellule.Select
End If
Next
End Sub










Avatar
francois.forcet
Rebonjours à toi

Et comme celà c'est mieux ????

For Each c In Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
If c <> "" Then
c.Select
End If
Next

Dis Moi !!!!
Avatar
Didier NOVARIN
Bonsoir Philippe,
C'est exactement cela parfait !!!
Mille merci et bonne soirée
Didier

"Philippe.R" <AS_rauphil_chez_wanadoo.fr> a écrit dans le message de news:

Re,
Cosi alors :

Sub Test()
Dim c As Range, maplage As String
Set Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
For Each c In Plg
If c.Value <> "" Then
zaza = c.Address
maplage = maplage & IIf(maplage = "", "", ",") & zaza
End If
Next
If maplage <> "" Then Range(maplage).Select
End Sub
--
Avec plaisir
http://dj.joss.free.fr/trombine.htm
http://jacxl.free.fr/mpfe/trombino.html
Philippe.R
Pour se connecter au forum :
http://www.excelabo.net/mpfe/connexion.php
News://news.microsoft.com/microsoft.public.fr.excel
"Didier NOVARIN" a écrit dans le message
de news:47f3d405$0$21142$
Bonsoir Philippe
Là, il me sélectionne que la dernière cellule, en fait, je voudrais que
la procédure sélectionne toute les cellules non vide
Merci
Didier


"Philippe.R" <AS_rauphil_chez_wanadoo.fr> a écrit dans le message de
news:
Bonsoir,
Essaye comme ceci :

Sub Test()
Dim cellule As Range
Set Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
For Each cellule In Plg
If cellule.Value <> "" Then
cellule.Select
End If
Next
End Sub
--
Avec plaisir
http://dj.joss.free.fr/trombine.htm
http://jacxl.free.fr/mpfe/trombino.html
Philippe.R
Pour se connecter au forum :
http://www.excelabo.net/mpfe/connexion.php
News://news.microsoft.com/microsoft.public.fr.excel
"Didier NOVARIN" a écrit dans le
message de news:47f3d128$0$21143$
Bonsoir,
Je souhaite écrire quelque chose comme cela, mais cela me renvoi une
erreur 4..
Je vous remercie
Didier

Sub Test()
Dim cellule As Range
Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row).Value
For Each cellule In Plg
If cellule <> "" Then
cellule.Select
End If
Next
End Sub













Avatar
Modeste
Bonsour® Philippe.R avec ferveur ;o))) vous nous disiez :

Cosi alors :

Sub Test()
Dim c As Range, maplage As String
Set Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
For Each c In Plg
If c.Value <> "" Then
zaza = c.Address
maplage = maplage & IIf(maplage = "", "", ",") & zaza
End If
Next
If maplage <> "" Then Range(maplage).Select
End Sub


é perqué no cosi ???
Sub Test()
Dim plg As Range, sel As Range
On Error Resume Next
Set plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row) '.Value
Application.Union(plg.SpecialCells(xlCellTypeFormulas, 23),
plg.SpecialCells(xlCellTypeConstants, 23)).Select
End Sub


--
@+
;o)))

Avatar
Mgr.Abile
Bonjour Modeste,
perqué ?
Mais parce que c'est mieux !
;o))
--
News://news.microsoft.com/microsoft.public.fr.excel
Allez en paix
T.Abile
"Modeste" a écrit dans le message de
news:%23USsf%
Bonsour® Philippe.R avec ferveur ;o))) vous nous disiez :

Cosi alors :

Sub Test()
Dim c As Range, maplage As String
Set Plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row)
For Each c In Plg
If c.Value <> "" Then
zaza = c.Address
maplage = maplage & IIf(maplage = "", "", ",") & zaza
End If
Next
If maplage <> "" Then Range(maplage).Select
End Sub


é perqué no cosi ???
Sub Test()
Dim plg As Range, sel As Range
On Error Resume Next
Set plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row) '.Value
Application.Union(plg.SpecialCells(xlCellTypeFormulas, 23),
plg.SpecialCells(xlCellTypeConstants, 23)).Select
End Sub


--
@+
;o)))





Avatar
Modeste
Bonsour® Mgr.Abile avec ferveur ;o))) vous nous disiez :

Bonjour Modeste,
perqué ?
Mais parce que c'est mieux !
;o)))

là c'est mieux !!!
Sub Test()
Dim plg As Range, FRML As Range, CSTS As Range
On Error Resume Next
'-----------plage ligne courante A:Z
Set plg = Range("A" & ActiveCell.Row & ":Z" & ActiveCell.Row) '.Value
'-----------plage avec formules
Set FRML = plg.SpecialCells(xlCellTypeFormulas, 23)
'-----------plage avec constantes
Set CSTS = plg.SpecialCells(xlCellTypeConstants, 23)

If FRML Is Nothing Then
If CSTS Is Nothing Then
MsgBox "pas de cellule documentée", vbInformation, "plage " & plg.Address
Exit Sub
Else
CSTS.Select
End If
Else
If CSTS Is Nothing Then
FRML.Select
Else
Application.Union(CSTS, FRML).Select
End If
End If

End Sub


--
--
@+
;o)))

1 2