本帖最后由 batman 于 2011-5-6 09:23 编辑
还是用数组来处理吧,下面给个示例,楼主对照着修改罗- '假如有4种药,每种药有3种剂量,每种药有2种化验
- Dim chufan(3, 2, 1), a, b, c, name, number, test
- namearray = Array("头胞", "葡萄糖", "阿期匹林", "刺五加")
- numberarray = Array("2ml", "4ml", "6ml")
- testarray = Array("甲类", "乙类")
- For a = 0 To 3
- name = name & a+1 & ":" & namearray(a) & " "
- For b = 0 To 2
- If a = 0 Then number = number & b+1 & ":" & numberarray(b) & " "
- For c = 0 To 1
- If a & b = "00" Then test = test & c+1 & ":" & testarray(c) & " "
- chufan(a, b, c) = namearray(a) & "-" & numberarray(b) & "-" & testarray(c)
- Next
- Next
- Next
- input = InputBox(name & vbcrlf & number & vbcrlf & test & vbcrlf & "请分别输入药品、剂量、化验的序号,中间请用-符号格开:")
- inputsplit = Split(input, "-")
- MsgBox chufan(inputsplit(0)-1, inputsplit(1)-1, inputsplit(2)-1)
复制代码
|