如何列出excel函数
发布网友
发布时间:2022-05-02 12:28
我来回答
共3个回答
热心网友
时间:2022-06-20 02:05
运行代码,共有168个组合,试下
Sub 排列组合()
Dim a%, B%, C%, D%, E%
For a = 1 To 2
For B = 1 To 3
For C = 1 To 7
For D = 1 To 1
For E = 1 To 4
n = n + 1
Cells(n, "f") = Cells(a, 1) & Cells(B, 2) & Cells(C, 3) & Cells(D, 4) & Cells(E, 5)
Next
Next
Next
Next
Next
End Sub
热心网友
时间:2022-06-20 02:06
你可将每列的第一行的单元格设置为数据有效性,如A1可下拉为“肝左叶”或“肝右叶”等,即可简单明了选择相关的参数,并得到 判断结果。
热心网友
时间:2022-06-20 02:06
按alt+F11打开VBA编辑器,双击左侧sheet1,在右侧空白窗口贴入下列代码,并点击顶部菜单的运行:
Sub AEUNION()
Counter = 1
For CounterA = 1 To 2 'A列从1到20,下同,可改
For CounterB = 1 To 3
For CounterC = 1 To 7
For CounterD = 1 To 1
For CounterE = 1 To 4
Set curCell = Worksheets("Sheet1").Cells(Counter, 6)
curCell.Value = Worksheets("Sheet1").Cells(CounterA, 1) + Worksheets("Sheet1").Cells(CounterB, 2) + Worksheets("Sheet1").Cells(CounterC, 3) + Worksheets("Sheet1").Cells(CounterD, 4) + Worksheets("Sheet1").Cells(CounterE, 5)
Counter = Counter + 1
Next CounterE
Next CounterD
Next CounterC
Next CounterB
Next CounterA
End Sub
花了10分钟给你写的并验证了,如果数据不一样,修改里面的counter*值。