发布网友 发布时间:2022-04-20 11:48
共1个回答
热心网友 时间:2022-03-31 16:15
这个需要用到VBA
For i = 3 To Range("f65536").End(xlUp).Row '循环所有行
If Cells(i, 1) <> "" Then a = i '确定合并开始行
If Cells(i, 6) <> 0 Then
If wb = "" Then '合并F列内容到wb
wb = Cells(i, 6)
Else
wb = wb & Chr(10) & Cells(i, 6)
End If
If Cells(i + 1, 6) = 0 Then '确定合并结束行并做出合并
Range("G" & a & ":G" & i).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Cells(a, 7) = wb
wb = ""
End If
End If
Next i