Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

custom function

Status
Not open for further replies.

bn2hunt

MIS
May 15, 2003
203
US
I have created a funtion in Excel VB

Public Function endid(var1 As String)
varlen = Len(var1)
startpar = InStr(var1, "(")
endpar = InStr(var1, ")")
idlen = endpar - startpar
endid = Mid(var1, startpar + 1, idlen - 1)
End Function

Workbook
cell a1 = Security Update for Microsoft Windows XP (KB328940)
cell b1 = +endid(a1)
I get an error in cell b1 #name?


I want to pass the contects of a cell and pull the data that is in between the parentheses. If I fill in var1 with data and step through it works and pull the info I want.
Thanks

DDNWOLFF
 
DDNWOLFF,

Your function and described test setup work perfectly on my machine (XL97/Win 98). Did you put the code in a normal code module?

Try putting a breakpoint at the end of your function so you can see what value it's trying to return. I suppose it's possible that it's not making the necessary jump to translate your range reference argument to a string containing the CONTENTS of that range (although it does on my machine!).

VBAjedi [swords]
 
Thanks, I figured it was something simple. This was my first custom function in excel so I wasn't exactly sure how to do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top