wps怎么批量快速合并不同数量的单元格,并且汇总合并单元格内的内容?
你这个用vba会比较快。
手动的话就得这样:
先复制A列张姓的人名,然后手动点开剪切板,再点击C列编辑栏,再点剪切板里面复制的内容,就可以达到效果了。
不过这样你要手动去操作每个姓名的序列
录了个vba代码,运行下应该会很快:
Sub 宏1()
Dim i, j, m
i = 2
j = Cells(i, 2)
Range("A" & i & ":A" & i + j - 1).Select
Selection.Copy
Range("C" & i & ":C" & i + j - 1).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = Trim(Cells(i, 1) & Chr(10) & Cells(i + 1, 1) & Chr(10) & Cells(i + 2, 1) & Chr(10) & Cells(i + 3, 1) & Chr(10) & Cells(i + 4, 1) & Chr(10) & Cells(i + 5, 1) & Chr(10) & Cells(i + 6, 1) & Chr(10) & Cells(i + 7, 1) & Chr(10) & Cells(i + 8, 1) & Chr(10) & Cells(i + 9, 1))
m = Application.WorksheetFunction.Count(Range("B:B"))
For q = 1 To m - 1
i = i + Cells(i, 2)
j = Cells(i, 2)
Range("A" & i & ":A" & i + j - 1).Select
Selection.Copy
Range("C" & i & ":C" & i + j - 1).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = Trim(Cells(i, 1) & Chr(10) & Cells(i + 1, 1) & Chr(10) & Cells(i + 2, 1) & Chr(10) & Cells(i + 3, 1) & Chr(10) & Cells(i + 4, 1) & Chr(10) & Cells(i + 5, 1) & Chr(10) & Cells(i + 6, 1) & Chr(10) & Cells(i + 7, 1) & Chr(10) & Cells(i + 8, 1) & Chr(10) & Cells(i + 9, 1))
Next
Range("C10").Select
End Sub