Kamis, 29 Juni 2017

Re: Sv: [ExcelVBA] Display strings in messagebox (blank-sensitive)

 

Apologies for coming late to this thread but here is another way :-

Function TrimReplace(sWord As String, Optional sReplacement As String = "*") As String
Dim sFrame As String, nLTrimmedLength As Long
    sFrame = String(Len(sWord), sReplacement)
    If Not Trim(sWord) = "" Then
        nLTrimmedLength = Len(LTrim(sWord))
        Mid(sFrame, Len(sWord) - nLTrimmedLength + 1, nLTrimmedLength) = Trim(sWord)
    End If
    TrimReplace = sFrame
End Function


Call it like :-
Debug.Print TrimReplace(" ABC    DEF   ")
or
Debug.Print TrimReplace(" ABC    DEF   ", "+")


I think this is what Torstein was asking for.

Derek +++



From: "Torstein Johnsen sejohnse@yahoo.no [ExcelVBA]" <ExcelVBA@yahoogroups.com>
To: "ExcelVBA@yahoogroups.com" <ExcelVBA@yahoogroups.com>
Sent: Tuesday, 27 June 2017, 11:15
Subject: Sv: [ExcelVBA] Display strings in messagebox (blank-sensitive)

 
My question/explanation may have been difficult to understand.

I want to display the strings in a messagebox (with or without blanks), but my problem is that I'm not able to see if the strings have blanks at the start or the end of the string.

I'm looking for how to "design" the listing in the messagebox so that I can see the blanks?

Torstein


Den Tirsdag, 27. juni 2017 8.06 skrev "'David Grugeon' grugeon@gmail.com [ExcelVBA]" <ExcelVBA@yahoogroups.com>:


 
You can use the TRIM function to remove the blanks.
 
Regards
David Grugeon
0429 029 836
 
From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com]
Sent: Tuesday, 27 June 2017 3:09 PM
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Display strings in messagebox (blank-sensitive)
 



 
I use Excel to manipulate several strings and the result is sensitive for blanks at the start and the end of the strings.
 
That means I like to know if there are blanks when the strings are listed in a messagebox.
 
Do anyone have a good idea how I can list the strings in a messagebox so that I know if there are blanks to the left or to the right of the string?
 
regards
 
Torstein
 







__._,_.___

Posted by: Derek Turner <g4swy@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (12)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

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

.

__,_._,___

Tidak ada komentar:

Posting Komentar