另请问大师,下列一些运算值的运算在 Excel中如何编写公式,典型的如下: 举例:35=3+5=8 20=2+10=12=1+2=3 100=10+0=10 123=1+2+3=6 156=1+5+6=12=1+2=3 105=1+0+5=6 无论两位,三位。同一使用公式如何做到?
我想到的是用分列再求和
我做了一个5位的宏,加一个按钮,一按就好。不知能不能用
Sub Macro1() ' ' Macro1 Macro ' 宏由 hh2 录制,时间: 2006-4-15 '
' Columns("A:A").Select Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _ FieldInfo:=Array(Array(0, 1), Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array _ (5, 1)), TrailingMinusNumbers:=True Range("A1:G16").Select Range("A16").Activate ActiveCell.FormulaR1C1 = "=SUM(R[-15]C:R[-1]C)" Range("A1:G16").Select Range("B16").Activate ActiveCell.FormulaR1C1 = "=SUM(R[-15]C:R[-1]C)" Range("A1:G16").Select Range("C16").Activate ActiveCell.FormulaR1C1 = "=SUM(R[-15]C:R[-1]C)" Range("A1:G16").Select Range("G1").Activate ActiveCell.FormulaR1C1 = "=SUM(RC[-6]:RC[-1])" Range("A1:G16").Select Range("G2").Activate ActiveCell.FormulaR1C1 = "=SUM(RC[-6]:RC[-1])" Range("A1:G16").Select Range("G3").Activate ActiveCell.FormulaR1C1 = "=SUM(RC[-6]:RC[-1])" Range("A1:G16").Select Range("G16").Activate ActiveCell.FormulaR1C1 = "=SUM(RC[-6]:RC[-1])" Columns("G:G").Select Selection.Copy Columns("A:A").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Columns("B:G").Select Application.CutCopyMode = False Selection.Delete Shift:=xlToLeft Range("A16").Select Selection.ClearContents End Sub
|