Passing Array to a function

E

Edward

Hi everybody,
I'm trying to pass an array to a bubble sort function but I get an error
type mismatch and I can't figure out why !
Any thoughts?
Sub test()
Dim MyArray(5) As String
MyArray(0) = "Bill"
MyArray(1) = "Amin"
MyArray(2) = "Tom"
MyArray(3) = "zibra"
MyArray(4) = "Carol"

BubbleSort (MyArray)
For i = LBound(MyArray) To UBound(MyArray)
Debug.Print MyArray(i)
Next i
End Sub

function BubbleSort(MyArray() As String)
'bubble sort code
End function
 
H

Helmut Weber

Hi Edward,

it is not

BubbleSort (MyArray)
but
BubbleSort MyArray

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top