Cells.SpecialCells(xlCellTypeConstants).Select
Bonjour
essaye cela :
Code:Cells.SpecialCells(xlCellTypeConstants).Select
Sub CellulesPleines()
Dim plein As Range, cel As Range
Set plein = [plage].Find("*", LookIn:=xlValues)
If plein Is Nothing Then MsgBox "Plage vide": Exit Sub
For Each cel In [plage]
If cel <> "" Then Set plein = Union(cel, plein)
Next
plein.Select
End Sub
Sub sel_plage()
Dim plage As Range, frm As Range, c As Range
Set plage = Range("A:E")
Set frm = plage.Cells.SpecialCells(xlCellTypeFormulas)
Set plage = plage.Cells.SpecialCells(xlCellTypeConstants)
For Each c In frm
If c.Text > "" Then Set plage = Application.Union(plage, c)
Next
plage.Select
End Sub
range("A:E").Cells.SpecialCells(xlCellTypeConstants).select
re:
bonjour job
il est vrai que j'ai omis les formules, mais venant de faire l'essai en mettant Range("B4") = "", la cellule n'est pas selectionnée donc c'est ok il reste les formules s'il y en a
voici avec les résultats de formules
si tu n'as pas de formule, le code reste :Code:Sub sel_plage() Dim plage As Range, frm As Range, c As Range Set plage = Range("A:E") Set frm = plage.Cells.SpecialCells(xlCellTypeFormulas) Set plage = plage.Cells.SpecialCells(xlCellTypeConstants) For Each c In frm If c.Text > "" Then Set plage = Application.Union(plage, c) Next plage.Select End Sub
Code:range("A:E").Cells.SpecialCells(xlCellTypeConstants).select