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

Range VBA

23 réponses
Avatar
Albert
Bonjour

Comment ré-écrire ce qui suit pour inclure la colonne A (A2 jusquà la fin)
et la colonne B (B2 jusqu'à la fin)?
----------------------
Sub EnleveAccent()
' Cette MACRO enlève tous les caractères accentuées et spécaux
Dim c As Range, Ctr As Long, i As Integer
For Each c In Range([A2], Cells(Rows.Count, 1).End(xlUp))
c.Value = Sans_accents$(c.Value)
Next c
End Sub
--------------------------------------------

Merci

--
albertri-at-videotron.ca.invalid

3 réponses

1 2 3
Avatar
isabelle
bonjour,

Sub test()
Dim c As Range, rw As Long
rw = Application.Max(Cells(Rows.Count, 1).End(xlUp).Row, Cells(Rows.Count,
2).End(xlUp).Row)
For Each c In Range("A2:B" & rw)
If WorksheetFunction.IsText(c.Value) Then c.Value = Sans_accents$(c.Value)
Next
End Sub

isabelle

Le 2014-11-22 14:50, Albert a écrit :
Bonjour

Comment ré-écrire ce qui suit pour inclure la colonne A (A2 jusquà la fin) et la
colonne B (B2 jusqu'à la fin)?
----------------------
Sub EnleveAccent()
' Cette MACRO enlève tous les caractères accentuées et spécaux
Dim c As Range, Ctr As Long, i As Integer
For Each c In Range([A2], Cells(Rows.Count, 1).End(xlUp))
c.Value = Sans_accents$(c.Value)
Next c
End Sub
--------------------------------------------

Merci

Avatar
GL
Le 23/11/2014 20:48, isabelle a écrit :
bonjour,

Sub test()
Dim c As Range, rw As Long
rw = Application.Max(Cells(Rows.Count, 1).End(xlUp).Row,
Cells(Rows.Count, 2).End(xlUp).Row)
For Each c In Range("A2:B" & rw)
If WorksheetFunction.IsText(c.Value) Then c.Value > Sans_accents$(c.Value)
Next
End Sub

isabelle



Ce qu'il y a de bien avec BASIC, c'est qu'il y a 12 mille façons
de faire la même chose, sans qu'on sache bien laquelle est la meilleure.

Alors qu'on attendrait d'un langage de macro un truc du style :

For Each c in CellsOf("A2:B*", TextValues+Constants) { ... }

qui est clair, parlant, et forcément aussi beaucoup plus efficace pour
un ordinateur.

Bonne soirée.
Avatar
Albert
Merci Isabelle

"isabelle" a écrit dans le message de
news:m4tdmp$ivn$
bonjour,

Sub test()
Dim c As Range, rw As Long
rw = Application.Max(Cells(Rows.Count, 1).End(xlUp).Row, Cells(Rows.Count,
2).End(xlUp).Row)
For Each c In Range("A2:B" & rw)
If WorksheetFunction.IsText(c.Value) Then c.Value =
Sans_accents$(c.Value)
Next
End Sub

isabelle



Merci


--
albertri-at-videotron.ca.invalid
1 2 3