Results 1 to 6 of 6

Detect vbCrLf in string

Threaded View

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Detect vbCrLf in string

    Hello everyone
    In these two macros the first return True and the second returns False

    Sub Test()
        Dim s As String, i As Integer
    
        s = Range("A2").Value
        i = 5
    
        Range("C1").Value = Right(s, i)
        Debug.Print Right(s, i) = String(5, vbTab)
    End Sub
    
    Sub Test2()
        Dim s As String, i As Integer
    
        s = Range("A2").Value
        i = 6
    
        Range("C1").Value = Right(s, i)
        Debug.Print Right(s, i) = vbCrLf & String(5, vbTab)
    End Sub
    Why the second macro returns False ..?
    I have copied the value of A2 to notepad++ and found that before the 5 tabs there is line carriage but VBA doesn't detect it
    How can I detect the vbCrLf ?
    Attached Files Attached Files
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] vbCrLf and vbLf
    By mikke in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-28-2014, 11:05 AM
  2. Add a vbCrLF
    By Harry Hof in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-28-2014, 06:59 AM
  3. What is vbCrLF & _
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-14-2014, 06:30 PM
  4. [SOLVED] Trim 'vbCrLf' from end of a string
    By Shane O in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2012, 10:31 AM
  5. Detect last time a string of text was used
    By BBL in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-29-2012, 05:59 PM
  6. Parse a String and detect ALT-ENTER?
    By KroogerFx in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-31-2009, 04:19 AM
  7. [SOLVED] how to Detect paragraph in cell in string?
    By dm16s in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2005, 05:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1