Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 37
Default Help exiting function needed !!!

I have written down a function which checks for "expiration" and other
like statements from another sheet within the same workbook. It
calculates that fine if I calculate that cell be cell. However, if I
calculate for the whole workbook, the calculation bar stops at 0%. When

I go into the debug mode, it takes me to the function which I wrote for

checking expiration, and then keep repeating in the same function. I
have run step by step execution, and I have found out that the control
goes back to the start even after it passes the return statement.
Someone, please help.
Here is my code:

Function DTS_Message()
sheet_name = "DTS"
count_exp = 0
count_caution = 0
' checking for negative value, if any. That shows if the value has
expired or not.
For Each cell In Sheets(sheet_name).Range("U:V")
If cell.value < 0 Then
count_exp = count_exp + 1
End If
Next cell
'if negative value found then go for expiration message.
If count_exp 0 Then
DTS_Message = "WARNING a Discard Time Requirement(s) has
expired!"
'if not then check for other condition i.e. caution flag
Else
For Each cell In Sheets(sheet_name).Range("Z:Z")
If cell.value = "Caution flag" Then
count_caution = count_caution + 1
End If
Next cell
'if there is a caution flag found then display this
If count_caution 0 Then
DTS_Message = "CAUTION a Discard Time Requirement(s) is
expiring shortly!"
Else
DTS_Message = "Discard Time Requirements are OK"
End If


End If


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
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
Function Needed! Please Help! Rashid Excel Worksheet Functions 3 April 20th 06 01:49 AM
Help needed with function Kevin Excel Worksheet Functions 2 January 28th 06 06:29 AM
Desperate Help needed with a function. Lori Excel Worksheet Functions 3 July 21st 05 03:19 AM
IF function help needed jmcclain Excel Worksheet Functions 2 February 23rd 05 04:33 PM


All times are GMT +1. The time now is 12:33 PM.

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"