You have to be careful because Excel may interpret 01-00010 as January 10, not as a string. So try this, entering and selecting as prompted. I did not hard code D5 as the range in case you need to do this on other sheets or if you change the sheet.
Sub Test()
Dim iStart As Integer
Dim iEnd As Integer
Dim i As Integer
Dim iLen As Integer
Dim R As Range
Dim v As Variant
iStart = CInt(InputBox("Starting number"))
iEnd = CInt(InputBox("Ending number"))
Set R = Application.InputBox("What cell has the serial number?", Type:=8)
v = Split(R.Text, "-")
iLen = Len(v(1))
R.NumberFormat = "@"
For i = iStart To iEnd
R.Value = "'" & v(0) & "-" & Right(String(iLen, "X") & i, iLen)
R.Value = "'" & Replace(R.Value, "X", "0")
ActiveSheet.PrintOut
Next i
End Sub
Bookmarks