Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Defined Type not Defined error Chip Pearson Excel Programming 0 December 7th 06 07:09 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 02:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"