Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to write a function to read a string and depending on the
contents of that string assign a type to it. The code below is just an example. I would use the IF function built-in to Excel but I have 15+ types and couple different ways to determine some of those types. This is my first function. When I use the following function, all I get is a '0' in the cell, not even my error message. That makes me think that I'm using the StrComp function incorrectly. For sample data I'm using: < 5KOLRAWAL1BI < 2USSTVRVS1GI < 5KOLTVWAL1BI Function ReadAdCode(strAdCode As String) Dim strAdType As String If StrComp(strAdCode, "*5KOL*", vbTextCompare) = 0 Then strAdType = "OTHER MEDIA" ElseIf StrComp(strAdCode, "*TV*", vbTextCompare) = 0 Then strAdType = "TVA" Else strAdType = "This is Not Working" End If End Function Any help is greatly appreciated! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
find and replace numeric strings in larger text strings | Excel Worksheet Functions | |||
=IF function, reference problem to "text strings" in Data Validati | Excel Discussion (Misc queries) | |||
How to refer to a text piece in a VBA custom function? | Excel Discussion (Misc queries) | |||
Custom number formats in TEXT function | Excel Worksheet Functions | |||
Reading long strings (with jdbc) from Excel | Excel Programming |