Link to home
Start Free TrialLog in
Avatar of Luis N
Luis NFlag for Spain

asked on

Sorting Spreadsheet Issue

Hi,

I am sorting a spreadhseet by the value of the column A. The first 2 rows are the header. The following code shows an error in the fourth line (Run-time error '1004': Sort method of Range class failed), but if I change the range of the With in the third line to ("A3:AL10")instead of ("A3:AL100") it works properly. Any solution or advice to extend that range to ("A3:AL100") ?

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A3:A100")) Is Nothing Then
With Range("A3:AL100")
.Sort key1:=.Cells(1, 1)
End With
End If
End Sub
Avatar of Simon
Simon
Flag of United Kingdom of Great Britain and Northern Ireland image

I can't replicate your error. The code you posted works fine for me. Can you post the workbook?
ASKER CERTIFIED SOLUTION
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've requested that this question be closed as follows:

Accepted answer: 500 points for gowflow's comment #a40602609

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.