Hi there, thanks for the reply!
Variable str replaced with myStr in above function
- to reduce risk of problems it is better to avoid using variable names that are identical to VBA function names etc
Noted!
You have not given details to allow your problem to be recreated and simply calling the function works fine for me.
When does code fail?
- when the workbook is opened?
- when any code runs?
- only when function DelParens is called?
How are you calling DelParens?
Gah- that's such a level 1 mistake on my part.
The intent of the custom function is to take the text from a particular cell and scan it for parenthesis. If any are found, it trims the parenthethetical text from the stringvalue and outputs the result.
In my workbook, as a dummy example, I have a table with the following columns:
[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD]First[/TD]
[TD]Last[/TD]
[TD]DelParensFirst[/TD]
[TD]DelParensLast[/TD]
[/TR]
[TR]
[TD]Thomas[/TD]
[TD]Smith (Jr)[/TD]
[TD]=delparens(table[First])[/TD]
[TD]=delparens(table[Last])[/TD]
[/TR]
</tbody>[/TABLE]
The output for the last 2 columns would be:
Thomas | Smith
The code fails when the workbook is opened, and closing the error window in the VBA Editor causes an infinite loop of Excel trying to open again, then failing with the same error...
In the VBA editor, the first line is highlighted in yellow:
Code:
[COLOR=#574123][FONT=monospace]Public Function DelParens(ByVal myStr As String) As String
[/FONT][/COLOR]
the function DelParens is only ever called in the table as a formula.
The thing I'm having trouble understanding is why some co-workers computers are fine opening the workbook, but others get this fatal error, and how to fix it.
Thanks again for the assistance!