如何找到Excel中的单元格是否合并?如果单元格如何读取值?
问题描述:
如何检测excel中的单元格是否合并?
How do I detect if a cell in excel is merged?
如果单元格合并,如何读取值?
If the cell is merged how do I read the value?
答
我不认为有没有公式告诉你一个单元格是否被合并。您可以撰写自己公开的 vba 功能的问题,放在在代码模块中,然后在您的工作表上使用它:
I don't think there's any formula to tell you if a cell is merged or not. You can write your own public vba function, put it in a code Module, and then use that on your sheet:
Function IsMerged(rCell As Range) As Boolean
' Returns true if referenced cell is Merged
IsMerged = rCell.MergeCells
End Function
然后作为Excel公式测试单元格 A1
:
Then as an Excel formula to test cell A1
:
=IsMerged(A1)