|
发表于 2013-6-11 21:54
|
显示全部楼层
本楼为最佳答案
- Private Sub CommandButton1_Click()
- Dim arr, arrTemp()
- Dim i As Long, j As Long
- Dim lLastRow As Long
- Dim arrNO, lNO As Long
- arr = CheckInput
- If Not IsArray(arr) Then Exit Sub
- i = Cells(Rows.Count, "k").End(xlUp).Row
- arrNO = Range("k3:k" & i).Value
-
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Application.EnableEvents = False
- Columns("d:f").ClearContents
- Range("d2").Resize(, 3) = Array("试室号", "座位号", "准考证号")
- For i = 1 To UBound(arr)
- If Len(arr(i, 1)) Then
- lLastRow = Cells(Rows.Count, "d").End(xlUp).Row + 1
- ReDim arrTemp(1 To arr(i, 2), 1 To 3)
- For j = 1 To arr(i, 2)
- lNO = lNO + 1
- arrTemp(j, 1) = Format(Val(arr(i, 1)), "'00")
- arrTemp(j, 2) = Format(j, "'00")
- arrTemp(j, 3) = Replace(arrNO(lNO, 1) & arrTemp(j, 1) & arrTemp(j, 2), "'", "")
-
- Next
- Cells(lLastRow, "d").Resize(arr(i, 2), UBound(arrTemp, 2)).Value = arrTemp
- Else
- Exit For
- End If
- Next
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- Application.EnableEvents = True
- End Sub
复制代码 |
评分
-
查看全部评分
|