不好意思,我能看懂VBA,但编的话还不是那么熟练。
想想还是挑战自己,编写了一个,这里没有设定参数,只是对A1单元格的内容在B列中显示,你试试,应该可以改参数,让你在使用过程中不必局限在对A1统计,在B列输出。不过,目前是可以对付你的输出问题的。
Subshow()
DimstrAsString
DimlocationAsInteger,rowAsInteger
DimnumStart,numEndAsInteger
row=0
str=Cells(1,1).Value
a=Split(str,\"、\")
Fori=0ToUBound(a)
row=row1
location=InStr(1,a(i),\"-\")
Iflocation0Then
numStart=Left(a(i),location-1)
numEnd=Mid(a(i),location1)
Forj=numStartTonumEnd
Cells(row,2)=j
row=row1
Next
row=row-1
Else
Cells(row,2)=a(i)
EndIf
Next
EndSub
代码贴上后,直接运行就可以了
|