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: 1,814
Default merge cells

Morning all.

Let's see.... I've modified an existing macro to test for borders, and to
merge the selected cells.

My If test appears to work ok, but my core operation doesn't.

My code is:



Code:
 

For Each rcell2 In Selection

      If rcell2.Borders(xlEdgeBottom).LineStyle = xlSolid Then

               ActiveSheet.Range(rcell1, rcell2).Select

               With Selection

                       .Merge

                       .VerticalAlignment = xlCenter

                       .HorizontalAlignment = xlCenter

               End With

               'Set rcell1 = Nothing

               'Set rcell2 = Nothing

               ActiveCell.Offset(1, 0).Select

      'end if

      End If

Next rcell2


I have 3 if tests outside of the above. My intention was to iterate through
a series of rows, looking for a border on top, and a border on the bottom,
after an undefined number of rows.



Once it finds the rows, I want to select them, and merge them.

However, in the case of my present macro, it merges, iterates through a
second set of rows, and selects the first set, and then selects, and merges
the second set with the first set.

This does not work.

My thinking at this point is that the rcell1 variable has the first row's
location still stored in its buffer, and if this indeed the case, I need the
rcell1 buffer emptied, to start with a new row location.

The problem is-- I'm not clear on how this is done. Anyone know how to do
this?

Thank you.

 
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
Automatically merge mulitiple cells to one cells Edward Wang Excel Worksheet Functions 5 September 15th 09 07:56 PM
Select Merged Cells and Unmerge Spread Merge Data To All Cells rtwiss via OfficeKB.com Excel Programming 2 October 2nd 08 04:24 AM
how do I merge cells into one then delete the original cells? LLR Excel Worksheet Functions 2 March 7th 08 10:59 PM
How can I have formatting options like merge cells ,Bold,active for the unlocked cells of the protected worksheet.Is it possible in excel? divya Excel Programming 2 July 20th 06 02:04 PM
How do I merge cells in Excel, like just 2 cells to make one big . chattacat Excel Discussion (Misc queries) 2 January 19th 05 04:25 PM


All times are GMT +1. The time now is 03:35 AM.

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

About Us

"It's about Microsoft Excel"