excel vba - By Reg Argument Type Mismatch, Where is it -


i created function demsontration purposes. believe represents problem facing.

function dostuff(thedates date, thevalues double)  dim themaxval double dim themaxdate date  themaxval = worksheetfunction.max(thevalues) themaxdate = worksheetfunction.max(thedates)   dostuff = array(themaxval, themaxdate)   end function 

then run sub use function :

sub test3()  sheet1  dim numdates integer numdates = range(.range("e2"), .range("e2").end(xldown)).cells.count  dim thedates() date redim thedates(numdates - 1)  dim thevalues() double redim thevalues(numdates - 1)  = lbound(thedates) ubound(thedates)     thedates(i) = .range("e2").offset(i, 0).value     thevalues(i) = .range("e2").offset(i, 1).value next  dim ddvector() variant  ddvector = dostuff(thedates, thevalues)  end  end sub 

basically, collect dates , values out of spread sheet , 2 arrays pass function "do suff" error of "byref argument type mismatch"k thedates. isn't declared date type?

thanks much.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -