View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Merge cells using macro

NumRows = 1
NumCols = 2
With Range("A4").Resize(NumRows,NumCols)
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = True
End With


Regards,
Tom Ogilvy

"Amy" wrote in message
...
I am trying to merge some cells using a macro. I'm
successful when using the command:

Range("A4:A5").select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = True
End With

However, the range of cells I want to merge is different
everytime, so I would like the macro to be able to count
the number of cells to be merged (some command that allows
definig a range using relative cell reference).

Thanks,

Amy