Sorting by rows with differing numbers of cell entries
06 SMITH DM in a cell cannot possibly be formatted as a number.
If you want a macro to sort across multiple rows here's one from Tom Ogilvy
Since your data is text, you may not get the sort result you want.
Sub SortRows()
'Tom Ogilvy macro
Dim R As Long
Dim lRow As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
lRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
'Make the r = 1 whatever the first row of data you want to sort on is.
'The Cells(r, 1) means your data starts in Col 1 or Col A - adjust as
'necessary
'The resize(1, 7) expands the range to 1 cell deep by 7 cells wide
For R = 1 To lRow
With Cells(R, 1).Resize(1, 7)
.Sort Key1:=Cells(R, 2), Order1:=xlAscending, Header:=xlGuess, _
Orientation:=xlLeftToRight, DataOption1:=xlSortNormal
End With
Next R
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Gord Dibben MS Excel MVP
On Tue, 16 Mar 2010 18:50:01 -0700, DayleMSCU
wrote:
I'm trying to sort each row. Each contains differing numbers of cell entries,
anywhere from 1 to 24. I've done a custom sort by selecting only the cells
containing data on each row then custom sorting etc, but I have over 2,300
individual rows to sort.
I also have problems with the blank cells. If I highlight a whole row they
seem to get placed first in the sort on each row.
The data in each cell starts with numbers like this: 01, 02, 03, 04, etc
with an author's name after, eg. 06 SMITH DM. It's the order of authors for
academic texts, so order is vital. All cells are formatted as numbers.
Hope someone can help.
|