I am currently designing a macro that will require 3 inputs from a user, I want to know if I could somehow require the numeric inputs to require a 5 digit serial number. And restrict anything that is more or less then five digits. This is my code so far:
Sub MRN_numbers()
Dim s, e As Integer
Dim m As String
s = InputBox("Please enter the starting 5 digit MRN number")
m = InputBox("please enter the material type")
If Not m = "ebara" Or m = "mirra" Or m = "300mm" Then
MsgBox ("Please enter valid material name!")
m = InputBox("Please enter the material type")
End If
e = InputBox("pleae enter the ending 5 digit MRN number")
Range("D1").Activate
Range("D65536").End(xlUp).Offset(1, 0).Activate
For i = s To e
If m = "ebara" Or m = "mirra" Or m = "300mm" Then
If m = "ebara" Then
For l = 1 To 5
ActiveCell.Value = i & "-" & l
ActiveCell.Offset(1, 0).Activate
ActiveCell.Offset(-1, -1).Value = "Ebara"
Next l
End If
If m = "mirra" Then
For r = 1 To 6
ActiveCell.Value = i & "-" & r
ActiveCell.Offset(1, 0).Activate
ActiveCell.Offset(-1, -1).Value = "Mirra"
Next r
End If
If m = "300mm" Then
For y = 1 To 4
ActiveCell.Value = i & "-" & y
ActiveCell.Offset(1, 0).Activate
ActiveCell.Offset(-1, -1).Value = "300mm"
Next y
End If
End If
Range("D65536").End(xlUp).Offset(1, 0).Activate
Next i
End Sub
I am not sure where to start on this, I watched videos but didn't find anything that helped, I am going to keep looking and trying different ways in the mean time, but any help on this would be appreciated.