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, "*"))這個語句有問題,請大神指導
我這個程序在一個EXCEL中運行沒問題,但是當我把代碼復制到另一個EXCEL中是就提示如下:
吃雞游戲
2023-03-31 13:09:14