Good morning!
I have a snippet that should take all the items in column B and convert it to text, and then format it to an exact 8 characters with leading 0s in front. I'm having issues having Excel force close and giving me out of stack error messages.
Sample Input:
0000123456
STR6611
Sample Output:
00123456
0STR6611
Any help would be appreciated!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LResult As String
Dim lr As Long
lr = Worksheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row
For rCount = 2 To lr
LResult = Range("B" & rCount).Value
Range("B" & rCount).Value = CStr(Format(LResult, "00000000"))
rCount = rCount + 1
Next
End Sub
Bookmarks