LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Case Else problem with #VALUE appearing in cells

Hello Guys,

I have the following function procedu

Function TotalCode(ByVal vCode As String, ByVal VB As Single, ByVal CAD As
Single, ByVal hours As Single, ByVal Roster As Single, ByVal ADVUren As
Single) As Single
Dim CodeNormal, CodePlus, CodeIll
CodeNormal = Array("ADV", "ANC", "CP", "EDUC", "ELF", "FAM", "FD", "JV",
"KV", "OA", "SOL", "ST", "SV", "TA", "TK", "V35", "VB", "VC", "VFD", "ZZ")
CodePlus = Array("ADV+", "ANC+", "CP+", "OA+", "SOL+", "SV+", "TK+", "V35+",
"VB+", "VC+", "Z+")
CodeIll = Array("AO", "Z")
Select Case vCode
Case cNormal
If vCode = CodeNormal Then
TotalCode = VB + ADVUren + CAD
End If
Case cPlus
If vCode = CodePlus Then
TotalCode = Rooster + ADVUren + CAD
End If
Case cIll
If vCode = CodeIll Then
TotalCode = Rooster + VB + ADVUren + uren + CAD
End If
Case Else
TotalCode = Rooster + VB + ADVUren + CAD
End Select
End Function

So I start using the function as a formula into a cell (=TotalCode(A1; B1;
C1...)

The problem seems to arise he
If vCode = CodeNormal Then
TotalCode = VB + ADVUren + CAD
End If

When vCode is not filled in, the formula keeps giving me #VALUE! into the
cell. If I get rid of the arrays, and use the codes itself (example):

If vCode = ADV then
TotalCode = VB + ADVUren + CAD
End If

It seems to work okay.

Any suggestions to get rid of the #VALUE! in the cell when nothing is filled
in?

Thanks in advance guys!

With kind regards,

Memento
 
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
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Certain Cells Appearing cts Excel Worksheet Functions 4 May 3rd 08 11:06 PM
How to change mixed case to upper case in Excel for all cells WordAlone Network Excel Discussion (Misc queries) 7 May 30th 07 05:53 AM
I want my cells to stop appearing in an outline format Beth without IT support Excel Discussion (Misc queries) 0 July 31st 06 10:39 PM
Hidden Cells Keep Appearing ShaiGuy New Users to Excel 3 September 15th 05 05:42 PM


All times are GMT +1. The time now is 06:25 AM.

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

About Us

"It's about Microsoft Excel"