|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 usedrange 于 2024-6-21 09:03 编辑
- Sub t2()
- Dim arr, brr, i%, m%, r%, j%
- arr = Sheet1.[a1].CurrentRegion
- m = UBound(arr): r = 1
- ReDim brr(1 To m, 1 To 3)
- For i = 1 To m
- If InStr(arr(i, 1), "大题") Then Exit For
- If InStr(arr(i, 1), "(") Or InStr(arr(i, 1), "(") Then
- brr(r, 1) = arr(i, 1)
- ElseIf InStr(arr(i, 1), "答案") Then
- brr(r, 3) = Mid(arr(i, 1), 5): r = r + 1
- Else
- brr(r, 2) = brr(r, 2) + arr(i, 1)
- End If
- Next i
- For j = i+1 To m
- brr(r, 1) = brr(r, 1) + arr(j, 1)
- If InStr(arr(j, 1), "答案") Then
- brr(r, 3) = Mid(arr(j, 1), 5)
- r = r + 1
- End If
- Next j
- Sheet2.[a5].Resize(UBound(brr), 3) = brr
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|