Hi Excel Forum!
Hoping someone can help me with a macro? I need to remove part of a string from several rows. The data looks like so...
As you can see the each string is unique before the double asterisks (**). The only thing that is consistent in each row are the double asterisks.http://domain.com/_ydlt=AfghTW_02JMxdgfh4xOKNcIF;_uylv=0/Sghjghjtg/**http://www.website1.com/ http://domain.com/_yglt=A0WTW_03FMx4OGMQAvymKNcIF;_uylv=0/SIG=13hmt1pttm/**http://www.website2.com/ http://domain.com/_gylt=A0WTW_05MsxeOjBEBNRKKNcIF;_uylv=0/SIG=119hto9nd8/**http://www.website3.com/ http://domain.com/_hylt=A0WTW_07OMxO34R0B7wuKNcIF;_uylv=0/SIG=1h10hntfuv/**http://www.website4.com/ ...
The portion of the string that I need isolated are the URLs at the end of each string after the characters double asterisks (**) in the example above.
Here is what a sample output would look like...
So I figure I need a macro to either remove all of the characters before double asterisks? Is that correct? Can anyone provide a macro that can accomplish what I need?http://www.website1.com/ http://www.website2.com/ http://www.website3.com/ http://www.website4.com/
Thanks!
This should do the job
Sub del_Astrisk() Dim MyCell As Range For Each MyCell In Range("A2:A" & Range("A" & Rows.count).end(xlup).row) On Error Resume Next MyCell = Mid(MyCell, Application.WorksheetFunction.Find("**", MyCell) + 2) Next MyCell End Sub
Google Me
Find me located here Simon Lloyd and what i'm about Here
The above is NOT a link to a forum so is NOT against Rule 13
No macro needed, put this formula in B1 and copy down:
=MID(A1, FIND("http", A1, 4), LEN(A1))
Or
=MID(A1, FIND("**", A1, 4) + 2, LEN(A1))
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
JB, it's great to give an alternative but the OP asked for a macro and posted in the excel vba programming forum![]()
You're both awesome just for answering my post in my book!
Thanks Simon! This worked perfectly!
JBeaucaire, since I love to learn, I can't seem to get it to work probably due to my lack of excel chops. When I entered the formula into B1 and copeid down "#VALUE!" was returned in all of my column C rows. There was no URLs though. Any suggestions?
Yes, post your workbook so I can see the real data and the formula as it is (not) working in your sheet. I'm sure it's something simple but non-obvious.
Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks