简体   繁体   中英

Select all cells below a merged cell in Excel/VBA

I'm trying to write a macro to copy and paste some cells. I want to select all of the cells directly below a merged cell.

So for example, if cell C5 was merged to E5, then I would want to select cells C6 to E6. However the width of the merged cell will differ, so I can't simply use Range("C6:E6").Select.

I don't want to include the merged cell in the selection, so I can't just use Range("C5:C6").

Any help would be much appreciated.

First select the merged cell group and then:

Sub dural()
    With Selection
        .UnMerge
        .Offset(1, 0).Select
        .Merge
    End With
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM