|
* 답변하시는 분들께 도움이 되도록 자신의 환경을 아래 항목 옆에 기재해 주세요.
- 엑셀 버전(95,97,2000,xp,2003,2007):2013
* 아래줄에 질문을 작성하세요 >>
병합된 셀값을 셀값으로 나타나게 해주세요.
(function으로 부탁드리니다.)
==============[정선택님 글에 대한 답변입니다]==============
첨부화일 참고하세요...
Function getSplit(rX As Range)
Dim iCnt As Integer, iSize As Integer, iX As Integer, iY As Integer
Dim vTemp, vResult
Application.Volatile
If rX.MergeCells Then
vTemp = Split(rX, vbLf)
iSize = rX.MergeArea.Cells.Count
ReDim vResult(1 To iSize, 1 To 1)
If iSize > (UBound(vTemp) + 1) Then iCnt = Int((iSize - (UBound(vTemp) + 1)) / 2)
For iX = LBound(vResult, 1) To UBound(vResult, 1)
If iX > iCnt Then iY = iY + 1
If iY >= 1 And iY <= UBound(vTemp) + 1 Then
vResult(iX, 1) = vTemp(iY - 1)
Else
vResult(iX, 1) = ""
End If
Next
Else
vResult = Array(rX.Value)
End If
getSplit = vResult
End Function
|
|