掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
セルの結合 (ID:104794)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
一つ前のセルを見るロジックは意味解らないけど? 様は移動列上段の列の下のセルがブランクなら上下結合って事なら こんな感じでどうですか? Dim oSheet As Worksheet 'ExcelSheet Dim lCol As Long Const clStartCol As Long = 1 Const clEndCol As Long = 255 Const cMoveRow As Long = 1 Const cChkRow As Long = 2 'CreateExcel(Appl,Book,Sheet)etc略 'カラム移動 For lCol = cStartCol To cEndCol 'シート参照 With oSheet 'カレント列二行目のブランク? If .Cells(cMoveRow, _ lCol).Value = vbNullString Then '範囲(行1:カレント列と行2:カレント列).結合 .Range(.Cells(cMoveRow, lCol), .Cells(cChkRow, lCol)).Merge End If End With Next
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.