wps表格用宏代码计算出现#NAME?提示说计算错误:引用了无效的名称
我写的代码如下帮我看一下哪里错了
Sub Macro1()
'
' Macro1 Macro
'
'
'
Columns("A:A").Select
Selection.Delete Shift:=xlShiftToLeft
Columns("C:F").Select
Selection.Delete Shift:=xlShiftToLeft
Cells.Select
Cells.ColumnWidth = 20
Cells.RowHeight = 28.5
Range("D1").Select
Selection.FormulaR1C1 = "佣金"
Range("D2").Select
Selection.FormulaR1C1 = "5"
Rows("1:1").Select
Selection.Insert Shift:=xlShiftDown
Range("E2").Select
Selection.FormulaR1C1 = "合计本金"
Range("E4").Select
Selection.FormulaR1C1 = "佣金"
Range("E3").Select
Selection.FormulaR1C1 = "=SUM(B3:B10000)"
Range("E5").Select
Selection.FormulaR1C1 = "=SUM(D3:D10000)"
Range("E6").Select
Selection.FormulaR1C1 = "合计"
Range("E7").Select
Selection.FormulaR1C1 = "=E3+E5"
Columns("A:F").Select
Selection.HorizontalAlignment = xlHAlignCenter
With Selection.Borders(xlEdgeLeft)
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Borders(xlEdgeTop)
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Borders(xlEdgeBottom)
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Borders(xlEdgeRight)
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Borders(xlInsideVertical)
.Weight = xlThin
.LineStyle = xlContinuous
End With
With Selection.Borders(xlInsideHorizontal)
.Weight = xlThin
.LineStyle = xlContinuous
End With
Selection.Borders(xlEdgeLeft).ColorIndex = xlColorIndexAutomatic
Selection.Borders(xlEdgeTop).ColorIndex = xlColorIndexAutomatic
Selection.Borders(xlEdgeBottom).ColorIndex = xlColorIndexAutomatic
Selection.Borders(xlEdgeRight).ColorIndex = xlColorIndexAutomatic
Selection.Borders(xlInsideVertical).ColorIndex = xlColorIndexAutomatic
Selection.Borders(xlInsideHorizontal).ColorIndex = xlColorIndexAutomatic
Range("E1:E10").Select
With Selection.Font
.Color = 255
.TintAndShade = 0
End With
Selection.Font.Bold = True
Selection.Font.Size = 14
End Sub