掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
EXCELオブジェクトを使って結合セルの値を取得 (ID:87045)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
MergeCellsValue関数を使うと別の結合セルが隣にあった場合おかしくなります。 よく考えたら、MergeAreaプロパティを使えば出来ますね(^^; With objSheet Text1.Text = Text1.Text & "A1" & vbTab & .Cells(1, 1).MergeArea.Cells(1, 1).Value & vbCrLf Text1.Text = Text1.Text & "B1" & vbTab & .Cells(2, 1).MergeArea.Cells(1, 1).Value & vbCrLf Text1.Text = Text1.Text & "C1" & vbTab & .Cells(3, 1).MergeArea.Cells(1, 1).Value & vbCrLf Text1.Text = Text1.Text & "D1" & vbTab & .Cells(4, 1).MergeArea.Cells(1, 1).Value & vbCrLf Text1.Text = Text1.Text & vbCrLf Text1.Text = Text1.Text & "A2" & vbTab & .Cells(1, 2).MergeArea.Cells(1, 1).Value & vbCrLf Text1.Text = Text1.Text & "B2" & vbTab & .Cells(2, 2).MergeArea.Cells(1, 1).Value & vbCrLf Text1.Text = Text1.Text & "C2" & vbTab & .Cells(3, 2).MergeArea.Cells(1, 1).Value & vbCrLf Text1.Text = Text1.Text & "D2" & vbTab & .Cells(4, 2).MergeArea.Cells(1, 1).Value & vbCrLf End With
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.