Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy paste non merged to merged cells [email protected] Excel Worksheet Functions 1 February 5th 09 05:25 PM
How can I sort an Excel Doc containing merged & non-merged cells? KellyH Excel Discussion (Misc queries) 11 June 10th 08 04:12 AM
Autofit Merged cell Code is changing the format of my merged cells JB Excel Discussion (Misc queries) 0 August 20th 07 02:12 PM
how do i link merged cells to a merged cell in another worksheet. ibbm Excel Worksheet Functions 3 April 27th 06 11:40 PM
Sorting merged cellsHow do I sort merged cells not identically siz Laval Excel Worksheet Functions 1 November 3rd 04 09:40 PM


All times are GMT +1. The time now is 07:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"