|
楼主 |
发表于 2013-10-30 15:10
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
表一到表二vba法:- Private Sub CommandButton1_Click()
- Dim arr As Variant
- Dim brr()
- Dim s As Integer
- Dim i As Integer
- Dim j As Integer
- Sheet4.Range("a1:j1") = Array("班级", "考号", "姓名", "语文", "数学", "英文", "政治", "历史", "地理", "生物")
- arr = Range("a3:e2053")
- ReDim brr(1 To UBound(arr), 1 To 10)
- For i = 1 To UBound(arr)
- If i Mod 7 = 1 Then
- j = j + 1
- s = 0
- brr(j, 1) = arr(i, 1)
- brr(j, 2) = arr(i, 2)
- brr(j, 3) = arr(i, 3)
- End If
- s = s + 1
- brr(j, 3 + s) = arr(i, 5)
- Next i
- Sheet4.Range("a2").Resize(UBound(brr), 10) = brr
- End Sub
复制代码 |
|