Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Coding - any ideas why this UDFs not working?


Function MyStatus(Status1 As Variant, Status2 As Variant)

If (Status1 = "n/a") And (Status2 = "n/a") Then
Result = "Authorised"

Else

If (Status1 = "n/a") And (Status2 < " ") Then
Result = "Misc"

Else

If (Status1 = "Pending") And (Status2 = "n/a") Then
Result = "Pending"

Else

If (Status1 = "Waiting Auth") And (Status2 = "n/a") Then
Result = "Pending"




End If
End If
End If
End If

Result = MyStatus


End Function

Mystatus invloved status1 and status2, which are lookup into different
sheets, basically if the lookup is #n/a then it brings back "n/a"

The result is coming back 0??

Any ideas? Thanks.


--
harpscardiff
------------------------------------------------------------------------
harpscardiff's Profile: http://www.excelforum.com/member.php...o&userid=25960
View this thread: http://www.excelforum.com/showthread...hreadid=475038

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default VBA Coding - any ideas why this UDFs not working?

Use MyStatus instead of Result

The Result syntax is not VBA

Niek Otten

"harpscardiff"
wrote in message
...

Function MyStatus(Status1 As Variant, Status2 As Variant)

If (Status1 = "n/a") And (Status2 = "n/a") Then
Result = "Authorised"

Else

If (Status1 = "n/a") And (Status2 < " ") Then
Result = "Misc"

Else

If (Status1 = "Pending") And (Status2 = "n/a") Then
Result = "Pending"

Else

If (Status1 = "Waiting Auth") And (Status2 = "n/a") Then
Result = "Pending"




End If
End If
End If
End If

Result = MyStatus


End Function

Mystatus invloved status1 and status2, which are lookup into different
sheets, basically if the lookup is #n/a then it brings back "n/a"

The result is coming back 0??

Any ideas? Thanks.


--
harpscardiff
------------------------------------------------------------------------
harpscardiff's Profile:
http://www.excelforum.com/member.php...o&userid=25960
View this thread: http://www.excelforum.com/showthread...hreadid=475038



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VBA Coding - any ideas why this UDFs not working?


harpscardiff wrote:



Result = MyStatus


The other way around? MyStatus = Result...

/impslayer

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Coding - any ideas why this UDFs not working?


You never assign a value to MYSTATUS. Try replacing the last statemen
with MYSTATUS=resul

--
MrShort
-----------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...fo&userid=2218
View this thread: http://www.excelforum.com/showthread.php?threadid=47503

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Coding - any ideas why this UDFs not working?


Cheers guys - wors a treat

--
harpscardif
-----------------------------------------------------------------------
harpscardiff's Profile: http://www.excelforum.com/member.php...fo&userid=2596
View this thread: http://www.excelforum.com/showthread.php?threadid=47503



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Coding - any ideas why this UDFs not working?


Hi guys,

In my vba code I want to add another statement to say to say somethin
like:


Code
-------------------


If (Status1 = "n/a") And Status2 = "System Error" Like "?System*" Then

MyStatus = "System Error"


-------------------


Basically if status2 contains System error then MyStatus = "Syste
Error"

Thanks for your help

--
harpscardif
-----------------------------------------------------------------------
harpscardiff's Profile: http://www.excelforum.com/member.php...fo&userid=2596
View this thread: http://www.excelforum.com/showthread.php?threadid=47503

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
the grab and drag function isn't working in excel any ideas? M Excel Discussion (Misc queries) 1 November 22nd 08 01:11 PM
Help and description for UDFs [email protected] Excel Worksheet Functions 0 March 13th 07 05:05 AM
UDFs DoctorG Excel Programming 3 July 5th 05 01:49 PM
=ROW-1 modified coding in filters not working in Excel 2002. StargateFanFromWork[_2_] Excel Programming 2 September 10th 04 10:24 AM
Acrobat 6.0 and UDFs Mike Lee[_2_] Excel Programming 0 January 29th 04 04:07 PM


All times are GMT +1. The time now is 01:36 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"