Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't pass publically defined variable to a function
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't pass publically defined variable to a function
You have a guess at your other post.
ExcelMonkey wrote: 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 -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't pass publically defined variable to a function
I don't see where you have declared cell. One thing to check is that in your
function header, you don't list any input parameters but rely on the public nature of the variable. However you do supply an input parameter when you call the function. Perhaps this is confusing Excel. -- Gary's Student "ExcelMonkey" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pass variable to NORMINSV function to get only mean value | Excel Worksheet Functions | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
Pass a Variable List Of Values To Subroutine or Function | Excel Programming | |||
Pass Variable Question | Excel Programming | |||
publically defined command bar variable problem | Excel Programming |