+ Reply to Thread
Results 1 to 2 of 2

Substring of a Chr(10) delimited cell

  1. #1
    Registered User
    Join Date
    03-10-2005
    Location
    East Greenbush, NY
    Posts
    26

    Question Substring of a Chr(10) delimited cell

    All -

    I have a range of cells (C2:C41) that contain 1 to 50 (variant) values separated by chr(10).

    i.e.
    C2 = "xyz"
    C3 = "xya ghi" (or the result of "xya" & chr(10) & "ghi"

    and so on

    So, I have in my macro

    For Each c In myRange
    curr_row = c.Row
    curr_col = c.Column

    tempString = c.Value
    i = Len(tempString) - Len(Replace(tempString, Chr(10), ""))
    'i = number of occurences of Chr(10)

    For j = 1 To i + 1
    curr_marker = InStr(prev_marker, tempString, Chr(10))
    'curr_marker = position of current Chr(10)
    Cells(curr_row, curr_col + j).Value = tempString.Characters(prev_marker, curr_marker - 1)
    prev_marker = curr_marker
    Next j

    Next c

    But as you will notice the tempString.characters doesn't work.

    How do I get a substring of tempString starting at position = prev_marker for a length of curr_marker - prev_marker?

    TIA!

    Heather Linsk
    h l i n s k @ g m a i l . c o m

  2. #2
    Registered User
    Join Date
    03-10-2005
    Location
    East Greenbush, NY
    Posts
    26

    Red face Answered my own question

    Completely forgot about Mid.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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