Public Sub format1()Dim ar, br(1 To 60000, 1 To 9), i, j, arr, t, k, n'maxrow1 = Cells(Rows.Count, "B").End(xlUp).RowColumns("E:E").Select' Range("E2").ActivateSelection.Replace What:="~*", Replacement:="×", LookAt:=xlPart, _SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ReplaceFormat:=FalseColumns("E:E").Select' Range("E2").ActivateSelection.Replace What:="X", Replacement:="×", LookAt:=xlPart, _SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ReplaceFormat:=Falsear = Range("a3", [f65536].End(3))For i = 1 To UBound(ar)arr = Split(ar(i, 5), "×")'If UBound(arr) - LBound(arr) + 1 > 2 Then ReDim Preserve arr(LBound(arr) To UBound(arr) - 1)ReDim Preserve arr(LBound(arr) To UBound(arr) - 1)t = Evaluate(Join(arr, "*"))n = n + t'For j = n To n - Val(ar(i, 5)) + 1 Step -1For j = n To n - t + 1 Step -1k = k + 1If j = n - t + 1 Thenbr(j, 1) = ar(i, 1)br(j, 2) = ar(i, 2)br(j, 3) = ar(i, 3)br(j, 4) = ar(i, 4)br(j, 5) = ar(i, 5)br(j, 9) = ar(i, 6)End Ifbr(j, 6) = t - k + 1Next jk = 0NextWith Sheets(1).Rows("3:" & .Rows.Count).ClearWith .[a3].Resize(n, 9).Value = br.Font.Size = 9.Resize(, 10).Borders.LineStyle = xlContinuousEnd WithEnd WithEnd Sub若点击调试的话会提出 t = Evaluate(Join(arr, "*"))这个语句有问题,请大神指导
- 2 回答
- 0 关注
- 194 浏览
添加回答
举报
0/150
提交
取消