EXCEL 方法Range作用于对象Global时失败
''Macro2Macro'Macrorecorded3/18/96byKENNETHWONG''SubMacro2()Range("A1").SelectActiveC...
'
' Macro2 Macro
' Macro recorded 3/18/96 by KENNETH WONG
'
'
Sub Macro2()
Range("A1").Select
ActiveCell.FormulaR1C1 = "'供货商"
Range("B1").Select
ActiveCell.FormulaR1C1 = "'期数"
Range("D1").Select
ActiveCell.FormulaR1C1 = "'票据编号"
Range("E1").Select
ActiveCell.FormulaR1C1 = "'发票日期"
Range("F1").Select
ActiveCell.FormulaR1C1 = "'到期日期"
Range("G1").Select
ActiveCell.FormulaR1C1 = "'单据编号"
Range("H1").Select
ActiveCell.FormulaR1C1 = "'未付金额"
Range("J1").Select
ActiveCell.FormulaR1C1 = "'原来金额"
Range("L1").Select
ActiveCell.FormulaR1C1 = "'原币未付金额"
Range("M1").Select
ActiveCell.FormulaR1C1 = "'币别"
Range("N1").Select
ActiveCell.FormulaR1C1 = "'付款方式"
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("E1"), DataType:= _
xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=True, Semicolon:=False, Comma:=False, Space _
:=False, Other:=False, FieldInfo:=Array(1, 5)
Columns("F:F").Select
Selection.TextToColumns Destination:=Range("F1"), DataType:= _
xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=True, Semicolon:=False, Comma:=False, Space _
:=False, Other:=False, FieldInfo:=Array(1, 5)
Columns("L:L").Select
Selection.Insert Shift:=xlToRight
Range("L1").Select
ActiveCell.FormulaR1C1 = "'到期分析"
Range("R1").Select
ActiveCell.FormulaR1C1 = "=COUNT(RC[-7]:R[9999]C[-7])+1"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],Araging.xls!ARAPTABLE,2,FALSE)"
Range("R1").Select
x = "L2:L" + Trim(Str(Selection.Value()))
MsgBox x
Range("L2").Select
Selection.AutoFill Destination:=Range(x), Type:=x1FillDefault
Columns("A:O").Select
Selection.Columns.AutoFit
End Sub
倒数第四行提示的错误...
Selection.AutoFill Destination:=Range(x), Type:=x1FillDefault
就这个是提示的错误 请问我要怎么修改才可以用 展开
' Macro2 Macro
' Macro recorded 3/18/96 by KENNETH WONG
'
'
Sub Macro2()
Range("A1").Select
ActiveCell.FormulaR1C1 = "'供货商"
Range("B1").Select
ActiveCell.FormulaR1C1 = "'期数"
Range("D1").Select
ActiveCell.FormulaR1C1 = "'票据编号"
Range("E1").Select
ActiveCell.FormulaR1C1 = "'发票日期"
Range("F1").Select
ActiveCell.FormulaR1C1 = "'到期日期"
Range("G1").Select
ActiveCell.FormulaR1C1 = "'单据编号"
Range("H1").Select
ActiveCell.FormulaR1C1 = "'未付金额"
Range("J1").Select
ActiveCell.FormulaR1C1 = "'原来金额"
Range("L1").Select
ActiveCell.FormulaR1C1 = "'原币未付金额"
Range("M1").Select
ActiveCell.FormulaR1C1 = "'币别"
Range("N1").Select
ActiveCell.FormulaR1C1 = "'付款方式"
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("E1"), DataType:= _
xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=True, Semicolon:=False, Comma:=False, Space _
:=False, Other:=False, FieldInfo:=Array(1, 5)
Columns("F:F").Select
Selection.TextToColumns Destination:=Range("F1"), DataType:= _
xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=True, Semicolon:=False, Comma:=False, Space _
:=False, Other:=False, FieldInfo:=Array(1, 5)
Columns("L:L").Select
Selection.Insert Shift:=xlToRight
Range("L1").Select
ActiveCell.FormulaR1C1 = "'到期分析"
Range("R1").Select
ActiveCell.FormulaR1C1 = "=COUNT(RC[-7]:R[9999]C[-7])+1"
Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],Araging.xls!ARAPTABLE,2,FALSE)"
Range("R1").Select
x = "L2:L" + Trim(Str(Selection.Value()))
MsgBox x
Range("L2").Select
Selection.AutoFill Destination:=Range(x), Type:=x1FillDefault
Columns("A:O").Select
Selection.Columns.AutoFit
End Sub
倒数第四行提示的错误...
Selection.AutoFill Destination:=Range(x), Type:=x1FillDefault
就这个是提示的错误 请问我要怎么修改才可以用 展开
1个回答
展开全部
Selection.AutoFill Destination:=Range(x), Type:=xlFillDefault
改成上面试试
改成上面试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询