Hi, the code below is being used to extract integer values from a string but I need the returned values to be formatted as TEXT with 4 characters i.e. "0000".
I'm new to Excel VBA so I'm not sure how to modify the code to do this.
I appreciate any help. Thank you
Sub MID_VNUM() Dim LastRow As Long Dim i As Long LastRow = Cells(Rows.Count, "B").End(xlUp).Row For i = 3 To LastRow Cells(i, 1).Value = Mid(Cells(i, 2).Value, 1, InStr(1, Cells(i, 2).Value, "-") - 2) Next i End Sub