EXCEL 中有合并的单元格、怎么做到遍历单元格的时候合并的单元格遍历一次?
3个回答
展开全部
就是说合并单元格只遍历一次?如果是这样,可以参考如下代码:
Dim i As Long
Dim j As Long
Dim oRange As Range
For i = 1 To 4
For j = 1 To 5
Set oRange = Cells(i, j)
If oRange.MergeCells Then
If oRange.Address = Left(oRange.MergeArea.Address, InStr(1, oRange.MergeArea.Address, ":", vbTextCompare) - 1) Then
MsgBox oRange.Value
End If
End If
Next
Next
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询