ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sort method (https://www.excelbanter.com/excel-programming/347535-sort-method.html)

badazizi

sort method
 
Why do I get a compile error 'Expected: =" when I try to call the following
procedure I created?

Private Sub SortPricingDataRange()
Dim myRange As Range
Set myRange = Worksheets("Sheet3").Range("A1:E6")
myRange.Sort _
Key1:=Worksheets("Sheet3").Range("A1"), _
Key2:=Worksheets("Sheet3").Range("B1"), _
Key3:=Worksheets("Sheet3").Range("C1"), _
Header:=xlYes
End Sub

Gary Keramidas

sort method
 
i didn't get an error, seemed to work ok with my test data

--


Gary


"badazizi" wrote in message
...
Why do I get a compile error 'Expected: =" when I try to call the
following
procedure I created?

Private Sub SortPricingDataRange()
Dim myRange As Range
Set myRange = Worksheets("Sheet3").Range("A1:E6")
myRange.Sort _
Key1:=Worksheets("Sheet3").Range("A1"), _
Key2:=Worksheets("Sheet3").Range("B1"), _
Key3:=Worksheets("Sheet3").Range("C1"), _
Header:=xlYes
End Sub




Tom Ogilvy

sort method
 
Your code ran fine for me. (even as the click event of a commandbutton on
another sheet).

--
Regards,
Tom Ogilvy


--
Regards,
Tom Ogilvy

"badazizi" wrote in message
...
Why do I get a compile error 'Expected: =" when I try to call the

following
procedure I created?

Private Sub SortPricingDataRange()
Dim myRange As Range
Set myRange = Worksheets("Sheet3").Range("A1:E6")
myRange.Sort _
Key1:=Worksheets("Sheet3").Range("A1"), _
Key2:=Worksheets("Sheet3").Range("B1"), _
Key3:=Worksheets("Sheet3").Range("C1"), _
Header:=xlYes
End Sub





All times are GMT +1. The time now is 10:23 AM.

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