+ Reply to Thread
Results 1 to 3 of 3

Split() method

  1. #1
    Registered User
    Join Date
    06-20-2005
    Posts
    30

    Split() method

    I cannot get the Split() method in VBA to work when there is leading whitespace.

    Also if I try to compare a string to the text in a cell, I have to actually copy the value from the cell and paste it into my VBA code for it to be equal. Even if I have the exact same string in my VBA code that I typed in, it will not say they are equal.

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    if suppose cell b2 = " testing , 456 , 567 "

    then in vba

    dim t as variant

    t=split(range("b2").value,",") 'splitting with delimiter comma (,)

    if ubound(t)>0 then

    for i=0 to ubound(t)
    msgbox t(i)
    next

    end if

    first value will be " testing ",
    then " 456 "
    then " 567 "

  3. #3
    Registered User
    Join Date
    06-20-2005
    Posts
    30
    Thanks for the help. My main problem was just getting the Trim() method to work and I figured that out.

+ 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