Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detecting merged cells
I have written a macro that searches a worksheet for lines of data that are
missing data from one column. It works except for when it reaches a header half way down the sheet that is a merged cell 5 cells wide. It treats this as 1 cell and so my conting system goes ary. How do you either deal with this or detect the fact that the activecell is part of a merged group of cells? I am new to this so don't worry about explaining in simple terms. Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detecting merged cells
Use the MergeArea property to determine whether a cell is merged.
If ActiveCell.MergeArea.Address < ActiveCell.Address Then Debug.Print "Cell merged" Else Debug.Print "Cell not merged" End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "microsoft" wrote in message ... I have written a macro that searches a worksheet for lines of data that are missing data from one column. It works except for when it reaches a header half way down the sheet that is a merged cell 5 cells wide. It treats this as 1 cell and so my conting system goes ary. How do you either deal with this or detect the fact that the activecell is part of a merged group of cells? I am new to this so don't worry about explaining in simple terms. Thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detecting merged cells
Hi
best suggestion: try to avoid merged cells at all :-) But if you want to detect a merged cell use something like If Range("A1").MergeCells Then msgbox "Cell A1 is part of a merged cell" End If -- Regards Frank Kabel Frankfurt, Germany microsoft wrote: I have written a macro that searches a worksheet for lines of data that are missing data from one column. It works except for when it reaches a header half way down the sheet that is a merged cell 5 cells wide. It treats this as 1 cell and so my conting system goes ary. How do you either deal with this or detect the fact that the activecell is part of a merged group of cells? I am new to this so don't worry about explaining in simple terms. Thanks in advance |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detecting merged cells
This all depends how you are referencing the column 5
If it like "Activecell.offset(0,4).value" then the merged cells will screw you up. Think about either looking for the merged property of the cell you are on, or trying to use another way to reference the 5th column cell - maybe using "Cells(activecell.row,5).address" or something along those lines. Perhaps post the section of code you are using to walk down and look across.. "microsoft" wrote: I have written a macro that searches a worksheet for lines of data that are missing data from one column. It works except for when it reaches a header half way down the sheet that is a merged cell 5 cells wide. It treats this as 1 cell and so my conting system goes ary. How do you either deal with this or detect the fact that the activecell is part of a merged group of cells? I am new to this so don't worry about explaining in simple terms. Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy paste non merged to merged cells | Excel Worksheet Functions | |||
How can I sort an Excel Doc containing merged & non-merged cells? | Excel Discussion (Misc queries) | |||
Autofit Merged cell Code is changing the format of my merged cells | Excel Discussion (Misc queries) | |||
how do i link merged cells to a merged cell in another worksheet. | Excel Worksheet Functions | |||
Sorting merged cellsHow do I sort merged cells not identically siz | Excel Worksheet Functions |