LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Problem finding merged cells

Having a problem finding merged cells through VBA.

Doing it through the interface works fine and I can also record the macro:

Sub Macro1()

With Application.FindFormat
.WrapText = False
.ShrinkToFit = False
.MergeCells = True
End With

Cells.Find(What:="", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=True).Activate

End Sub

However if I then run the above macro it fails: Object variable or With
block not set,
which I think it can't find the merged cells.

Even when I make sure that any other formatting options are cleared I get
the same error:

Sub FindMergedCells()

Application.FindFormat.Clear
Application.FindFormat.MergeCells = True

Cells.Find(What:="", _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=True).Activate

Application.FindFormat.Clear

End Sub

I know I could loop through all the cells of the used range and look for
MergeCells, but that is
much slower.

Any suggestions how to do this?


RBS

 
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
Finding Merged Cells melissa Excel Discussion (Misc queries) 1 December 7th 07 12:36 PM
Finding Merged Cells (Part 2) - Free 58k macro Olden Excel Discussion (Misc queries) 0 January 17th 07 11:24 AM
Problem with code for merged cells SuitedAces[_25_] Excel Programming 5 July 7th 06 09:40 PM
Finding merged cells R D S Excel Discussion (Misc queries) 6 February 25th 05 07:59 PM
merged cells problem Libby Excel Programming 1 May 8th 04 09:42 AM


All times are GMT +1. The time now is 11:54 AM.

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"