Excel VBA Macro: Remove Special Characters (in List of Strings) & Post New Strings Next to Old Ones

Excel VBA Macro: Remove Special Characters (in List of Strings) & Post New Strings Next to Old Ones
💥Subscribe: / @greggowaffles
Code:
Sub remove_spec_chars_in_list()
Dim ws As Worksheet
Dim spec_chars As Variant
Dim x As Variant
Dim row_count As Integer
Dim i As Integer
Dim cur_str As String
Set ws = ThisWorkbook.Sheets("Sheet1")
spec_chars = Array("<", ">", "\", "/", "?", "*", ":", """", "|")
ws.Activate
row_count = WorksheetFunction.CountA(Range("A1", Range("A1").End(xlDown)))
For i = 2 To row_count
cur_str = ws.Cells(i, 1).Text
For Each x In spec_chars
cur_str = Replace(cur_str, x, "")
Next x
ws.Cells(i, 2) = cur_str
Next i
End Sub
#excelvba #excelmacro

Пікірлер: 5

  • @IndustrialGuy
    @IndustrialGuy Жыл бұрын

    Your tutorials are helping me immensely as I sort out my companies processes and make data entry much easier. Thanks for your clear and concise work dude!!

  • @greggowaffles

    @greggowaffles

    Жыл бұрын

    Really appreciate the feedback!! Would be open to any video topic suggestions as you come across them at your company. Thanks!!

  • @kameya1104
    @kameya1104 Жыл бұрын

    Learned something new today on looping an array... awesome... thanks

  • @greggowaffles

    @greggowaffles

    Жыл бұрын

    Glad to hear that. Thanks for watching!!

  • @vijayannamasivayam8806
    @vijayannamasivayam8806 Жыл бұрын

    I have too many "-_ in a string, i have to retain the first one then replace all with none