Answer the question
In order to leave comments, you need to log in
How to leave only letters and numbers in a column?
There is a column in Excel with articles, and I need to leave only letters and numbers in it and remove the rest of the characters, how can I do this if I'm not a programmer?
You can, of course, not in Excel, but copy it to a notepad, for example, akelpad or notepad ++ and do something there, just what?
Answer the question
In order to leave comments, you need to log in
Open macro editor (Alt+F11)
Add new module
add custom function
Public Function SanitizeCharDigit(ByRef rng As Range) As String
Dim pattern As String
Dim replace As String
Dim RegExp As Object 'Для регулярных выражений
pattern = "[^A-Z\d]"
replace = ""
Set RegExp = CreateObject("VBScript.RegExp")
With RegExp
.Global = True 'Находим ВСЕ совпадения или только первое
.IgnoreCase = True 'Учитываем ли регистр?
.MultiLine = True 'Может ли паттерн попадать на разрывы строк?
.pattern = pattern 'Выражение
End With
On Error Resume Next
SanitizeCharDigit = RegExp.replace(CStr(rng.Value), replace) 'Поиск и замена
Set RegExp = Nothing 'Очистка памяти от ненужного мусора
End Function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question