View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default Can't pass publically defined variable to a function


Your AdjustForUniqueFormula function isn't defined to take any
arguments, so you can't pass it any. If your cell variable is truly public
you don't need to pass it to the function at all, the function will be able
to "see" it because it's public.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"ExcelMonkey" wrote in message
...
I have a variable called "cell" which I have dimensioned as a Range. I
also
have a function called AdjustForUniqueFormula. When I pass this public
variable to the funtion

AdjustForUniqueFormula(cell)

I get a Run Time Error 13 Type Mismatch. Why is this?

If AdjustForUniqueFormula(cell) = True Then
Exit Sub
Else
'Do Something........
End if

Public Function AdjustForUniqueFormula()

If UniqueFormulasAdjustChkBx = True Then
If Not IsError(Application.WorksheetFunction.Match(cell.P arent.Name &
"!" & cell.Address, UniqueCellAddressArray3, 0) - 1) Then
AdjustForUniqueFormula = False
Else
AdjustForUniqueFormula = True
End If
Else
AdjustForUniqueFormula = False
End If
End Function