ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA sort does not work (https://www.excelbanter.com/excel-discussion-misc-queries/159593-vba-sort-does-not-work.html)

Farhad

VBA sort does not work
 
Hi,

i have code below to sort a range in my worksheet but it doesn't work
however i can sort it by manually

Sheets(1).Range("A" & Trim(Str(strt)) & ":Q" & Trim(Str(endd -
1))).Select
Selection.Sort Key1:=Range("A" & Trim(Str(strt))),
Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal

i am stock on this problem please help.

Thanks,

--
Farhad Hodjat

Don Guillett

VBA sort does not work
 
sort key SHEETS
or use a with statement


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Farhad" wrote in message
...
Hi,

i have code below to sort a range in my worksheet but it doesn't work
however i can sort it by manually

Sheets(1).Range("A" & Trim(Str(strt)) & ":Q" & Trim(Str(endd -
1))).Select
Selection.Sort Key1:=Range("A" & Trim(Str(strt))),
Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal

i am stock on this problem please help.

Thanks,

--
Farhad Hodjat



Farhad

VBA sort does not work
 
Hi Don,

Thank you for your respond but i found it in the Header:=xlYes i should
choos Header:=xlNo

Regards,
--
Farhad Hodjat


"Don Guillett" wrote:

sort key SHEETS
or use a with statement


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Farhad" wrote in message
...
Hi,

i have code below to sort a range in my worksheet but it doesn't work
however i can sort it by manually

Sheets(1).Range("A" & Trim(Str(strt)) & ":Q" & Trim(Str(endd -
1))).Select
Selection.Sort Key1:=Range("A" & Trim(Str(strt))),
Order1:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal

i am stock on this problem please help.

Thanks,

--
Farhad Hodjat





All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com