Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You wrote that NIG is an integer, but NHold is declared as Long....
HTH, JP On Mar 10, 11:06*pm, wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing reference to a checkbox to a subroutine. | Excel Programming | |||
Passing Constant Arguments to custom Subroutine & Functions | Excel Programming | |||
Passing Module to subroutine | Excel Programming | |||
Excel vba - passing a 3-dimensional array to a subroutine | Excel Programming | |||
Passing arrays to a subroutine | Excel Programming |