Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
User-defined type not defined
I am using this custom formula on a worksheet, and sometimes I get '
User-defined type not defined' error message. (However, the formula works). How can I avoid this error? Thanks! Function SumActualPlusForecast(Y_Actual As Range, PeriodsRange As Range, ValuesRange As Range, strThisYear As String) As Double For iItem = 1 To 12 If Left(Trim(PeriodsRange.Cells.Item(iItem).Value), 4) = strThisYear Then intForecastTotal = intForecastTotal + ValuesRange.Cells.Item(iItem).Value End If Next iItem SumActualPlusForecast = Y_Actual + intForecastTotal End Function |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
User-defined type not defined
Try declaring your variables... Also compile your code Debug - Compile
Function SumActualPlusForecast(Y_Actual As Range, PeriodsRange As Range, ValuesRange As Range, strThisYear As String) As Double dim iItem as integer dim intForecastTotal as integer For iItem = 1 To 12 If Left(Trim(PeriodsRange.Cells.Item(iItem).Value), 4) = strThisYear Then intForecastTotal = intForecastTotal + ValuesRange.Cells.Item(iItem).Value End If Next iItem SumActualPlusForecast = Y_Actual + intForecastTotal End Function -- HTH... Jim Thomlinson " wrote: I am using this custom formula on a worksheet, and sometimes I get ' User-defined type not defined' error message. (However, the formula works). How can I avoid this error? Thanks! Function SumActualPlusForecast(Y_Actual As Range, PeriodsRange As Range, ValuesRange As Range, strThisYear As String) As Double For iItem = 1 To 12 If Left(Trim(PeriodsRange.Cells.Item(iItem).Value), 4) = strThisYear Then intForecastTotal = intForecastTotal + ValuesRange.Cells.Item(iItem).Value End If Next iItem SumActualPlusForecast = Y_Actual + intForecastTotal End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
User Defined Type not Defined error | Excel Programming | |||
"User-defined type not defined" message in Excel | Excel Discussion (Misc queries) | |||
Workspace faux user-defined type not defined | Excel Programming | |||
User-defined data type; Error: Only User-defined types... | Excel Programming | |||
Word.Document - user defined type not defined | Excel Programming |