ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Split() method (https://www.excelbanter.com/excel-programming/332304-split-method.html)

reddog9069[_2_]

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.


--
reddog9069
------------------------------------------------------------------------
reddog9069's Profile: http://www.excelforum.com/member.php...o&userid=24458
View this thread: http://www.excelforum.com/showthread...hreadid=380570


anilsolipuram[_84_]

Split() method
 

if suppose cell b2 = " testing , 456 , 567 "

then in vba

dim t as variant

t=split(range("b2").value,",")

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 "


--
anilsolipuram
------------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
View this thread: http://www.excelforum.com/showthread...hreadid=380570


anilsolipuram[_85_]

Split() method
 

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 "


--
anilsolipuram
------------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
View this thread: http://www.excelforum.com/showthread...hreadid=380570


reddog9069[_3_]

Split() method
 

Thanks for the help. My main problem was just getting the Trim() metho
to work and I figured that out

--
reddog906
-----------------------------------------------------------------------
reddog9069's Profile: http://www.excelforum.com/member.php...fo&userid=2445
View this thread: http://www.excelforum.com/showthread.php?threadid=38057



All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com