#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Merge Cells

Can someone help me out with a macro that will merge & center a number of
cells?

Data looks like this

Column A Column B
1. ABC Company Category 1
2. Category 2
3. Category 3
4. Category 4
5. Category 5
6. Category 6
7. XYZ Company Category 1

and so on and so forth. What I want to do is to have a macro merge & center
A1:A6, then move on to A7:A12.

Can someone help me out?
Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Merge Cells

Hi Dominique,
If I were you I wouldn't do that. It's a lot easier to
read it the title is at the top of a merged cell (IMO).

It would make it so you can sort rows.

You could include the company in each cell in column A
and use Conditional formatting to make it "disappear" or
be lighter if equal to the cell above.

This will do what you asked for merging
change xlTop to xlCenter if that's what you really want.

Macro cannot be rerun, suggest testing on a copy of your worksheet.

Sub Macro1()
With Cells
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
End With
On Error GoTo done
Cells(Rows.Count, 2).End(xlUp).Activate
ActiveCell.Offset(0, -1).Activate
backthe
Range(ActiveCell.Address, ActiveCell.End(xlUp).Address).Select
Selection.Merge
ActiveCell.Offset(-1, 0).Activate
GoTo backthere
done:
End Sub

--
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Dominique Feteau" wrote in message ...
Can someone help me out with a macro that will merge & center a number of
cells?

Data looks like this

Column A Column B
1. ABC Company Category 1
2. Category 2
3. Category 3
4. Category 4
5. Category 5
6. Category 6
7. XYZ Company Category 1

and so on and so forth. What I want to do is to have a macro merge & center
A1:A6, then move on to A7:A12.

Can someone help me out?
Thanks





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Merge Cells

I don't completely understand what the end result will look
like, but you might want to explore the use of something like:
Worksheets(sheetname).Columns("AE").EntireColumn.A utoFit
-----Original Message-----
Can someone help me out with a macro that will merge &

center a number of
cells?

Data looks like this

Column A Column B
1. ABC Company Category 1
2. Category 2
3. Category 3
4. Category 4
5. Category 5
6. Category 6
7. XYZ Company Category 1

and so on and so forth. What I want to do is to have a

macro merge & center
A1:A6, then move on to A7:A12.

Can someone help me out?
Thanks


.

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
Merge Cells CarlainCerebroMode Excel Worksheet Functions 1 April 12th 10 11:43 AM
Automatically merge mulitiple cells to one cells Edward Wang Excel Worksheet Functions 5 September 15th 09 07:56 PM
how do I merge cells into one then delete the original cells? LLR Excel Worksheet Functions 2 March 7th 08 10:59 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
Merge Cells R. Stevens Excel Discussion (Misc queries) 2 December 15th 04 09:30 PM


All times are GMT +1. The time now is 08:14 PM.

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"