+ Reply to Thread
Results 1 to 4 of 4

Returning a character from a string

  1. #1
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Returning a character from a string

    Hi,

    I need to return each char from a string.

    A1 contains "London"

    StrLen = Len(Cells(1, 1).Value)
    For q = 1 To StrLen
    ch = Left(Cells(1, 1), q)
    msgbox "Letter" & ch
    next q

    In the first loop run (q=1) it returns 'L' but in the second run (q=2) it returns 'Lo', however I need only 'o' in the second run.

    London is an example text, the length of the string will vary.

    Please help

    Thanks
    Abdul
    Last edited by abduljaleel.mca; 03-14-2013 at 07:32 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-05-2013
    Location
    Jakarta, Indonesia
    MS-Off Ver
    Excel 2013
    Posts
    571

    Re: Returning a character from a string

    use mid() function
    Please Login or Register  to view this content.
    Click (*) if you received helpful response.

    Regards,
    David

  3. #3
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: Returning a character from a string

    It works great. Thanks

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Returning a character from a string

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

+ 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