rabers
05-11-2012, 02:41 AM
hi,
i have a function called: "ColumnsToUse" and it goes like this:
Function ColumnsToUse()
.
.
Dim StaticColumnArray() As Integer
ReDim StaticColumnArray(1 To Length) As Integer
.
bla bla bla
.
.
ColumnsToUse = StaticColumnArray
End Function
and I also has a function to remove duplicates from a range called: "AllData"
Sub Button1_Click()
ActiveSheet.Range("AllData").RemoveDuplicates ColumnsToUse(), Header:=xlYes
End Sub
* the ColumnsToUse is an integer array.
the Function itself works well and ColumnsToUse holds the desired array.
but at the Button1 Sub i get: "Subscript out of range"
any idea why?
please assist
thanks
Rabers
i have a function called: "ColumnsToUse" and it goes like this:
Function ColumnsToUse()
.
.
Dim StaticColumnArray() As Integer
ReDim StaticColumnArray(1 To Length) As Integer
.
bla bla bla
.
.
ColumnsToUse = StaticColumnArray
End Function
and I also has a function to remove duplicates from a range called: "AllData"
Sub Button1_Click()
ActiveSheet.Range("AllData").RemoveDuplicates ColumnsToUse(), Header:=xlYes
End Sub
* the ColumnsToUse is an integer array.
the Function itself works well and ColumnsToUse holds the desired array.
but at the Button1 Sub i get: "Subscript out of range"
any idea why?
please assist
thanks
Rabers