ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help with merge cells in a macro (https://www.excelbanter.com/excel-programming/301527-need-help-merge-cells-macro.html)

Armando[_3_]

Need help with merge cells in a macro
 
Hello all,

I am writing a macro that needs to cycle through all the
active rows with in the active sheet, and filter out all
the rows that contain a date that is not in the specified
paramaters.

My problem is that some of these rows have merged cells
and when I lter out a row, it leaves behind the ones that
were merged with it. I need all the rows to disappear.

I was thinking that I could check to see if the row was
merged first and capture the address of the merged
fields. Then I would unmerge the rows and populate the
newly unmerged cells with what was in the original cell.

I can check if the cells are merged by:

If Range("myRange").MergeCells then
Set merge = Range("myRange").MergeArea
addr = merge.address
val = Range("myRange").Value

This is as far as I know.
How can I assign the value of the merged cells to all the
cells once they are unmerged?
Please help.

Thank you.

No Name

Need help with merge cells in a macro
 
I figured it out. Thanks anyways.

Armando
-----Original Message-----
Hello all,

I am writing a macro that needs to cycle through all the
active rows with in the active sheet, and filter out all
the rows that contain a date that is not in the specified
paramaters.

My problem is that some of these rows have merged cells
and when I lter out a row, it leaves behind the ones that
were merged with it. I need all the rows to disappear.

I was thinking that I could check to see if the row was
merged first and capture the address of the merged
fields. Then I would unmerge the rows and populate the
newly unmerged cells with what was in the original cell.

I can check if the cells are merged by:

If Range("myRange").MergeCells then
Set merge = Range("myRange").MergeArea
addr = merge.address
val = Range("myRange").Value

This is as far as I know.
How can I assign the value of the merged cells to all the
cells once they are unmerged?
Please help.

Thank you.
.



All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com