以下是引用303hd在2006-11-3 15:16:02的发言:从第五行开始看不懂,谁能解释一下 Sub Me_Micro() Dim t_Str$ Dim i% Dim Bh() As String For n = 2 To [B65536].End(xlUp).Row Bh = Split(Cells(n, 2), "编号") If UBound(Bh) > 0 Then For i = 1 To UBound(Bh) t_Str = t_Str & i & Split(Cells(n, 2), "编号")(i) Next Cells(n, 2) = t_Str End If Next End Sub 代码主要在于Split的用法,你可以找找帮助或看看相关资料,我这里大致说下 如 s = "a,b,c" bn = split(s,",") '就是说把s变量,按,分开成一个数组。这时bn就是一个数组,从0开始,具体为: bn(0) = "a",bn(1) = "b",bn(2) = "c" 例子中是按“编号”来分开的Bh = Split(Cells(n, 2), "编号"),如单元格里为“a编号1”,则按上面的分开之后就是bn(0) = "a",bn(1) = "1" |