Convert Range of Years to Individual list (integers)
Hi
Look at this:
Sub aaa()
Dim Del As Long
Dim StartYear As Long
Dim EndYear As Long
Dim y As Long
Dim off As Long
Del = WorksheetFunction.Find("-", Range("A1").Value)
StartYear = Left(Range("A1").Value, Del - 1)
EndYear = Mid(Range("A1").Value, Del + 1)
For y = StartYear To EndYear
Range("A1").Offset(off, 0) = y
off = off + 1
Next
End Sub
Regards,
Per
On 6 Maj, 23:19, wrote:
For example, I need to convert this:
1995-2000 (1 column, 1 row)
to this:
1995
1996
1997
1998
1999
2000 (1 column, 6 rows)
If anyone can help, it will be greatly appreciated!
|