Excel macro for cell merge

  • Thread starter Thread starter grammad
  • Start date Start date
G

grammad

I used to use Lotus 123 when I was working ages ago. I have Excel 97
and know next to nothing about using it.
I have imported my checking account records for one year into an
Excel worksheet. The first column is called Post/Tran and there are
two rows -one for the posted date and one for the transaction date. I
want to sort the worksheet data, but it will not allow a sort because
all of the cells are not the same size. I (surprisingly) was able to
record a macro to do this for one set of cells, but I need to do it
for the whole column (564) lines.

Here is the macro I have:
Keyboard Shortcut: Ctrl+m
'
Range("A37:A38").Select
Range("A38").Activate
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.IndentLevel = 0
.ShrinkToFit = False
.MergeCells = True
End With
Range("A40").Select
Application.Run "'2007 Checking History through 0ct 7.xls'!Macro5"
End Sub

What is the next step?.

Thank you,
Shirley
 
All cells not the same size, by that do you mean that some cells are
merged? That is the only way this could occur, and does not make
sense since a merged cell can only contain one data value after
merge. The macro you are demonstrating merges two cells in column A,
but does not sort. It is possible that your cells B37:B38 are also
merged, thus allowing you to perform a sort. However, your ideal
solution is to remove all merged cells, period. Select everything, go
to Format -> Cells, select Alignment, and uncheck Merge Cells.

Also, the above macro does not sort. It is possible that Macro5 in
"2007 Checking History through Oct 7.xls" performs the sorting, but it
is impossible to tell why that works without looking at your workbook
and seeing all the code.
 
Back
Top