XX 和YY 最大最小是多少,什么范围?
假设为 -10至10
C1:
=MID("-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10",FIND(","&A1,"-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10")+1,FIND(","&B1,"-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10")-FIND(","&A1,"-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10")+1)
Sub t()
For r = 2 To Range("A65536").End(xlUp).Row
If Cells(r, 1) <> "" And Cells(r, 2) <> "" And Cells(r, 1) <= Cells(r, 2) Then
zz = ""
For i = Cells(r, 1) To Cells(r, 2)
zz = zz & i & ","
Next
zz = Left(zz, Len(zz) - 1)
Cells(r, 3) = "'" & zz
Else
Cells(r, 3) = "错误"
End If
Next
End Sub
'会用宏就用宏,不会用就当我没说
sub test()
dim cel as range,tempStr as string ,i as integer
for each cel in range("a1:a8")
tempStr=""
for i=val(cel) to val(cel.offset(0,1))
if tempStr<>"" then tempStr=tempstr & ";"
tempstr=tempstr & i
next
cel.offset(0,2)=tempstr
next
end sub
c2输入
=a2&","&b2
下拉