本帖最后由 霞竹之景 于 2012-11-6 18:07 编辑
我在录制宏后运行代码实,跳出如下对话框,不知如何解决,请各位老师指点一二(下面有原代码)。谢谢!
Sub 订单粉末用量计算() ' ' 订单粉末用量计算 Macro '
' Rows("1:1").Select Selection.AutoFilter ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.AddKey:=Range _ ("E1"), SortOn:=xlSortOnValues, Order:=xlAscending,DataOption:= _ xlSortNormal With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With Columns("I:I").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("I1").Select ActiveCell.FormulaR1C1 = "单面积" With ActiveCell.Characters(Start:=1, Length:=3).Font .Name = "宋体" .FontStyle = "常规" .Size = 9 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .TintAndShade = 0 .ThemeFont = xlThemeFontNone End With Columns("J:J").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("J1").Select ActiveCell.FormulaR1C1 = "总面积" Range("I2").Select ActiveCell.FormulaR1C1 = _ "=VLOOKUP(RC[-8],[2012.09.11价格总表.xls]Sheet1!R2C3:R5100C24,21,0)" Range("J2").Select ActiveCell.FormulaR1C1 = "=RC[-4]*RC[-1]" Range("I2:J2").Select Selection.AutoFill Destination:=Range("I2:J200"),Type:=xlFillDefault Range("I2:J200").Select ActiveWindow.SmallScroll Down:=-90 ActiveWindow.ScrollRow = 104 ActiveWindow.ScrollRow = 102 ActiveWindow.ScrollRow = 101 ActiveWindow.ScrollRow = 98 ActiveWindow.ScrollRow= 95 ActiveWindow.ScrollRow = 89 ActiveWindow.ScrollRow = 85 ActiveWindow.ScrollRow = 79 ActiveWindow.ScrollRow = 73 ActiveWindow.ScrollRow = 68 ActiveWindow.ScrollRow = 59 ActiveWindow.ScrollRow = 56 ActiveWindow.ScrollRow= 52 ActiveWindow.ScrollRow = 49 ActiveWindow.ScrollRow = 46 ActiveWindow.ScrollRow = 43 ActiveWindow.ScrollRow = 42 ActiveWindow.ScrollRow = 39 ActiveWindow.ScrollRow = 36 ActiveWindow.ScrollRow = 31 ActiveWindow.ScrollRow= 27 ActiveWindow.ScrollRow = 26 ActiveWindow.ScrollRow = 21 ActiveWindow.ScrollRow = 18 ActiveWindow.ScrollRow = 14 ActiveWindow.ScrollRow = 10 ActiveWindow.ScrollRow = 7 ActiveWindow.ScrollRow = 1 ActiveWindow.ScrollRow = 2 ActiveWindow.ScrollRow = 4 ActiveWindow.ScrollRow = 5 ActiveWindow.ScrollRow = 8 ActiveWindow.ScrollRow = 10 ActiveWindow.ScrollRow = 11 ActiveWindow.ScrollRow = 13 ActiveWindow.ScrollRow = 14 ActiveWindow.ScrollRow= 15 ActiveWindow.ScrollRow = 17 ActiveWindow.ScrollRow = 18 ActiveWindow.ScrollRow = 20 ActiveWindow.ScrollRow = 21 ActiveWindow.ScrollRow = 23 ActiveWindow.ScrollRow = 24 ActiveWindow.ScrollRow = 26 ActiveWindow.ScrollRow= 27 ActiveWindow.ScrollRow = 29 ActiveWindow.ScrollRow = 27 ActiveWindow.ScrollRow = 26 ActiveWindow.ScrollRow = 24 ActiveWindow.ScrollRow = 21 ActiveWindow.ScrollRow = 18 ActiveWindow.ScrollRow = 17 ActiveWindow.ScrollRow= 15 ActiveWindow.ScrollRow = 13 ActiveWindow.ScrollRow = 11 ActiveWindow.ScrollRow = 10 ActiveWindow.ScrollRow = 7 ActiveWindow.ScrollRow = 5 ActiveWindow.ScrollRow = 2 ActiveWindow.ScrollRow = 1 ActiveWindow.SmallScroll ToRight:=6 Range("P1").Select ActiveCell.FormulaR1C1 = "塑粉名称" With ActiveCell.Characters(Start:=1, Length:=4).Font .Name = "宋体" .FontStyle = "常规" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .TintAndShade = 0 .ThemeFont = xlThemeFontNone End With Range("Q1").Select ActiveCell.FormulaR1C1 = "塑粉用量" With ActiveCell.Characters(Start:=1, Length:=4).Font .Name = "宋体" .FontStyle = "常规" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .TintAndShade = 0 .ThemeFont = xlThemeFontNone End With Range("Q2").Select ActiveCell.FormulaR1C1 = "=SUMIF(C[-12],RC[-1],C[-7])/5.32" Range("Q2").Select Selection.AutoFill Destination:=Range("Q2:Q11"),Type:=xlFillDefault Range("Q2:Q11").Select Columns("Q:Q").Select Selection.NumberFormatLocal = "0.00_);[红色](0.00)" ActiveWindow.SmallScroll Down:=-6 End Sub
|