VBA UDF Remove * [star{s}] ___SOLVED By PaddyD

Jack in the UK

Well-known Member
Joined
Feb 16, 2002
Messages
3,215
I have designed this UDF OK wonderful for races or { [ } } ( ) or whatever but i can not remover stars * ??? why not can this be edited??? Any ideas guys

Function JackintheUK_RemvBraces(MyRange As Range) As String
Dim strResult As String
Application.Volatile
If InStr(1, MyRange, "(")<> 0 Then
strResult = Trim(Left(MyRange, _
WorksheetFunction.Search("(", MyRange) - 1))
Else
strResult = MyRange
End If

JackintheUK_RemvBraces = strResult
End Function

_________________<embed width="200" height="50" src="http://homepage.a5.com/~kristy/misc/jack.swf">
This message was edited by Jack in the UK on 2002-09-18 15:27
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Wierd, knowing sod all about the inticacies of VBA, I

a) assumed that the same method you'd use in a workbook find - replace for special characters would apply
b) was surprised Jack hadn't thought of it!

But:

<pre>


Function JackintheUK_RemvStars(MyRange As Range) As String
Dim strResult As String
Application.Volatile
If InStr(1, MyRange, "~*") <> 0 Then
strResult = Trim(Left(MyRange, _
WorksheetFunction.Search("~*", MyRange) - 1))
Else
strResult = MyRange
End If

JackintheUK_RemvStars = strResult
End Function



</pre>


Has no effect whatsoever. Bugger!

Paddy
 
Upvote 0
PaddyD

LOLOLOLOLOLOLOLO OUT VERY LOUD !!!

Duh i dun no!

HELP !!!! i try all i could tide* ** *** ?? ?* and ermmm

Yup i did all i could think off!!!
 
Upvote 0
found one that works:<pre>

Public Function CleanFileName(fNameStr As String)
Dim i As Integer
Const NO_NO_STRING = "/'<|> *" 'Add or remove "no-no's"
For i = 1 To Len(NO_NO_STRING)
fNameStr = Application.WorksheetFunction.Substitute(fNameStr, _
Mid(NO_NO_STRING, i, 1), "")
Next i
CleanFileName = fNameStr
End Function</pre>


see:

http://makeashorterlink.com/?S146526D1


Paddy
This message was edited by PaddyD on 2002-09-18 15:13
 
Upvote 0
Hi PaddyD

Ok some errors leave trail of _____ underscore so i have edited

STRING, i, 1), "")

PERFECTION!!! Well done tanks for that .. I love UDF

Your friend Jack!
 
Upvote 0

Forum statistics

Threads
1,202,898
Messages
6,052,437
Members
444,581
Latest member
naninamu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top