Hi ajxecc,

 

Try this code:

 

Sub mergedetect()
Dim c As Range
For Each c In Range("A1:A10")
If c.MergeCells = True Then MsgBox c.Address & " is merged with another cell."
Next c
End Sub


Change the Range ref to suit your needs.

You can change the code after the "Then" keyword, to do anything you want.

 

Regards - Dave.
 
> Date: Tue, 14 Apr 2009 13:40:57 -0700
> Subject: $$Excel-Macros$$ Check if selected area contains some merged cells.
> From: ajx...@gmail.com
> To: excel-macros@googlegroups.com
> 
> 
> Hello
> 
> I'm trying to write a small excel vba script that returns "TRUE" if in
> a selected area of cells there are any merged cells.
> 
> Sounds simple, but I haven't found the solutions yet... :-(
> 
> Is there a poperty that I can check for "merged cells"??? Or any other
> trick that helps????
> 
> Any hint is greatly appreciated.. ;-)
> 
> thanks in advance.
> 
> ajxecc
> 
> > 

_________________________________________________________________
View photos of singles in your area Click Here
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fdating%2Eninemsn%2Ecom%2Eau%2Fchannel%2Findex%2Easpx%3Ftrackingid%3D1046247&_t=773166080&_r=Hotmail_Endtext&_m=EXT
--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to