Passing ranges to a subroutine

T

tkpmep

Friends,

I'm having trouble passing a range from one subroutine to another, and
I'd appreciate some help with my problem. In the main routine I write

Set Portfolio = ActiveWorkbook.Worksheets("Hedging").Range("C2",
Range("C2").End(xlDown))

I then call the subroutine fillIndex as follows:

Call fillIndex(Portfolio, "IG", IGCol, NIG, NIGInPort, lastRow, IG)

IGCol, NIG and NIGinPort are integers and IG is an array of length
NIG.


fillIndex is defined in the same module as follows:

Sub fillIndex(Portfolio As Range, CDXIndexName As String, Col As Long,
NHold As Long, IndexHoldingsinPort As Long, lastRow As Long,
Holdings() As Variant)
..
end sub

But when I try to execute it, the parameter NIG is consistently
highighted, and the following error message appears: ByRef Argument
type mismatch. What am I doing wrong, and how can I fix it?

Thanks in advance

Thomas Philips
 

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