Home |
Search |
Today's Posts |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() try this Sub expandyears() Dim Outputstr As String RowCount = 1 Do While Range("A" & RowCount) < "" Years = Range("A" & RowCount) FirstYear = Val(Trim(Years)) LastYear = Val(Trim(Mid(Years, InStr(Years, "-") + 1))) Outputstr = "" YearCount = FirstYear Mod 100 Do While (1) If Outputstr = "" Then Outputstr = Format(YearCount, "#00") Else Outputstr = Outputstr & Format(YearCount, " #00") End If If YearCount = LastYear Then Exit Do Else YearCount = (YearCount + 1) Mod 100 End If Loop Range("B" & RowCount).NumberFormat = "@" Range("B" & RowCount) = Outputstr RowCount = RowCount + 1 Loop End Sub -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=145620 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Convert Range of Years to Individual list (integers) | Excel Programming | |||
convert # of years, months and days | Excel Discussion (Misc queries) | |||
Need to convert years into days | Excel Discussion (Misc queries) | |||
Convert years to years and days | Excel Discussion (Misc queries) | |||
how do i calculate CAGR for a series of years of revenues? | Excel Worksheet Functions |