Sub 公式() Application.Calculation = xlCalculationManual '手动重算 y = Sheets(1).Range("a65536").End(xlUp).Row 'A列最后可见单元的行号 Range("K1").Select Selection.FormulaArray = "=INDEX(lei_0,MATCH(,COUNTIF(R1C10:RC[-1],lei_0),))" Range("K1:U1").Select Selection.FillRight Range("K2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("L2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("M2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("N2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("O2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("P2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("Q2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("R2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("S2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("T2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("U2").Select Selection.FormulaArray = _ "=INDEX(min_0,MATCH(,COUNTIF(R1C11:R[-1]C,min_0)+(lei_0<>R1C),))" Range("K2").Select Application.Calculation = xlCalculationAutomatic '自动重算 ActiveWindow.SmallScroll Down:=15 Range("K2:U" & y).Select Selection.FillDown Range("K1:U" & y).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("K2").Select Application.CutCopyMode = False End Sub |