Apr 28 2020 12:39 AM - edited Apr 28 2020 12:41 AM
Please Help Me
I want a VBA so that I enter the starting number and the ending number and all the number between them gets autofilled. For example, I will type MDN001 in the starting box and MDN010 in the ending box and the number between them gets auto filled and gets transfered to a separate sheet.
Thanks in advance,
Regards,
Wit Emperor
Apr 28 2020 02:00 AM
Hi,
Please try this one:
Sub FillFromStartingToEnding()
Dim starting As Integer
Dim ending As Integer
starting = Right(Range("B1").Value, 3)
ending = Right(Range("B2").Value, 3)
Range(Range("D2"), Range("D2").Offset(ending - 1, 0)).Select
Selection.Value = "MDN"
For Each cell In Selection
cell.Value = cell.Value & Application.WorksheetFunction.Text(starting, "000")
starting = starting + 1
Next
End Sub
Hope that helps