Name: takana Date: 2009/01/08 17:06'***************************************************************************** '[ 関数名 ] GetDoRange '[ 概 要 ] 横方向の結合セルがある時、一番結合幅が広いセルのみ実行対象とする '[ 引 数 ] 選択されたセル '[ 戻り値 ] 実行対象のセル '***************************************************************************** Private Function GetDoRange(ByRef objSelection As Range) As Range Dim objArea As Range Dim i As Long Dim objLeftCol As Range Dim objRightCol As Range Dim objWkRange(1 To 2) As Range Dim lngMaxMergeWidth As Long Dim objMergeCol As Range For Each objArea In objSelection.Areas For i = 1 To objArea.Columns.Count Set objMergeCol = GetMergeCol(objArea.Columns(i).EntireColumn, objSelection) Set objLeftCol = objMergeCol.Columns(1) Set objRightCol = objMergeCol.Columns(objMergeCol.Columns.Count) Set objWkRange(1) = ArrangeRange(Intersect(objLeftCol, objSelection)) Set objWkRange(2) = ArrangeRange(Intersect(objRightCol, objSelection)) Set GetDoRange = UnionRange(GetDoRange, Intersect(objWkRange(1), objWkRange(2))) i = i + objMergeCol.Columns.Count - 1 Next i Next End Function
返信する |