VB6.0+excel2003 做一个简单的会议室安排座位的工具,做到这一步,与我计划中不一样,求解
无法贴图,用文字表述排数 座位号 部门
1 1 aaaa
1 2 aaaa
1 3 aaaa
2 1 aaaa
2 2 aaaa
2 3 cccc
2 4 cccc
3 1 cccc
3 2 cccc
3 3 cccc
3 4 cccc      表一单位 人数 座位号(错) 我要的效果
aaaa 5 第 1排 1- 2 坐 第 1排 1- 3坐、第 2排 1- 2 坐
cccc 6 第 2排 3- 4 坐 第 2排 3- 4 坐、第 3排 1- 4 坐
    表二
我的代码:
Private Sub Command4_Click()
Dim i As Integer
Dim x As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer
Dim e As Integer
Dim j As Integer
Dim k As Integer
j = xlsheet01.UsedRange.Rows.Count
k = xlsheet02.UsedRange.Rows.Count
i = 2
x = 2
For x = 2 To k
c = xlsheet01.Cells(i, 2)
d = xlsheet01.Cells(i, 1)
For i = i To j
 If xlsheet01.Cells(i, 3) <> xlsheet01.Cells(i + 1, 3) Then
   
      a = xlsheet01.Cells(i, 1)
      b = xlsheet01.Cells(i, 2)
      xlsheet02.Cells(x, 3) = "第" + Str(d) + "排" + Str(c) + "-" + Str(b) + " 坐"
     Exit For
 End If
Next i
i = i + 1
 Next x
End Sub