Hi all, I'm hoping to get some help expanding a REALLY useful macro I found in another thread. The code below takes a value and removes any special characters (including spaces) and outputs the result in the neighboring column.
Sub SpecialCharacters()'removes all special characters from contents of column A, INCLUDING spaces 'outputs value in column B Dim a$, b$, c$, i As Integer a$ = Range("A1").Value For i = 1 To Len(a$) b$ = Mid(a$, i, 1) If b$ Like "[A-Z,a-z,0-9]" Then c$ = c$ & b$ End If Next i Range("B1").Value = c$ End Sub
I can't figure out how to expand the macro to be able to run through any/all values in column A. Currently, as you can see, the macro refers to specific cells and takes the value of A1, then outputs the result into cell B1. My column A length will vary and I need this code to be able to run through column A as long as there is a value there, and then output the result into the corresponding cell in column B.
Hopefully I made sense here. I attached a sample document illustrating what I'm asking for, the doc also includes the code posted here. Thanks to all for your help!!