I see now. I had misremembered some of the problem.
How about this.
You add a column to the range that shows the rowheight for that row.
You sort the data (including that column) and then after the sort, you use the
value in that column to reset the rowheight. Then you clean up that helper
column.
This may give you a start.
Option Explicit
Sub testme()
Dim myRngToSort As Range
Dim wks As Worksheet
Dim FirstRow As Long
Dim LastRow As Long
Dim FirstCol As Long
Dim LastCol As Long
Dim iRow As Long
Set wks = Worksheets("sheet1")
With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
FirstCol = 1
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For iRow = FirstRow To LastRow
.Cells(iRow, LastCol + 1).Value = .Rows(iRow).RowHeight
Next iRow
Set myRngToSort = .Range(.Cells(FirstRow, LastRow), _
.Cells(LastRow, LastCol + 1))
With myRngToSort
.Sort key1:=.Columns(1), order1:=xlAscending, _
header:=xlYes
End With
For iRow = FirstRow To LastRow
.Rows(iRow).RowHeight = .Cells(iRow, LastCol + 1).Value
Next iRow
.Columns(LastCol + 1).ClearContents
End With
End Sub
Randy said:
Dave,
Yup. That's what I do too. And then manually set the height. But the macro
somehow trashes it. Maybe someone good in VBA will have an idea of some code
I could include to stop this.
Thanks!
--Randy