abi_learn_vba
Board Regular
- Joined
- Nov 6, 2009
- Messages
- 215
Hi
I am getting "Manage Range of object Global failed" error while i am passing an range value to sort a set of data. Please see my code below am i wrong somewhere?
here rng = C3:C932
Even if i use Activesheet.Range(rng) i am getting "Application Defined or Object defined Error"
Am i going wrong somewhere?
Thanks
-Abi
I am getting "Manage Range of object Global failed" error while i am passing an range value to sort a set of data. Please see my code below am i wrong somewhere?
here rng = C3:C932
Code:
Sub srt1(ByVal books As Worksheet, ByVal rng As Range, ByVal val As Double)
books.sort.SortFields.Clear
books.sort.SortFields.Add Key:=[COLOR=red]Range(rng),[/COLOR] SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With books.sort
.SetRange Range("A2:T" & val)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Even if i use Activesheet.Range(rng) i am getting "Application Defined or Object defined Error"
Am i going wrong somewhere?
Thanks
-Abi