Hello Experts. I just started learning about VBA and got below problem. In below example, column A is a huge set of cells that has strings with URLs in it. I need to extract only URL starting from "http" keyword. There are no cases when this string has more than one URL.
I searched internet and found following formula somehow working for me, however I could never figure out how to get VBA macro for this purpose.
B1=MID(A1,FIND("http",A1),IFERROR(FIND(" ",A1,FIND("http",A1))-1,LEN(A1))-FIND("http",A1)+1)
I request you to please help me out here. I would be sincerely thankful.
IMPORTANT: In final VBA solution, I need a VBA which can just remove extra text from COLUMN A and leaves the URL string in COLUMN A itself. I dont want to copy it to anywhere else.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]http://eworld.com/first/[/TD]
[TD]http://eworld.com/first/[/TD]
[/TR]
[TR]
[TD]https://pacbell.com/[/TD]
[TD]https://pacbell.com/[/TD]
[/TR]
[TR]
[TD]MW http://intranet/solar/ (external)[/TD]
[TD]http://intranet/solar/[/TD]
[/TR]
[TR]
[TD]https://mbos.google.com
(internal link)[/TD]
[TD]https://mbos.google.com[/TD]
[/TR]
[TR]
[TD]N/A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]External link is http://mynah.sbc.com (outside)[/TD]
[TD]http://mynah.sbc.com[/TD]
[/TR]
[TR]
[TD]NOT VALID[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1 PROD
2 TEST http://www.text.com[/TD]
[TD]http://www.text.com[/TD]
[/TR]
[TR]
[TD]ERROR[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I searched internet and found following formula somehow working for me, however I could never figure out how to get VBA macro for this purpose.
B1=MID(A1,FIND("http",A1),IFERROR(FIND(" ",A1,FIND("http",A1))-1,LEN(A1))-FIND("http",A1)+1)
I request you to please help me out here. I would be sincerely thankful.
IMPORTANT: In final VBA solution, I need a VBA which can just remove extra text from COLUMN A and leaves the URL string in COLUMN A itself. I dont want to copy it to anywhere else.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]http://eworld.com/first/[/TD]
[TD]http://eworld.com/first/[/TD]
[/TR]
[TR]
[TD]https://pacbell.com/[/TD]
[TD]https://pacbell.com/[/TD]
[/TR]
[TR]
[TD]MW http://intranet/solar/ (external)[/TD]
[TD]http://intranet/solar/[/TD]
[/TR]
[TR]
[TD]https://mbos.google.com
(internal link)[/TD]
[TD]https://mbos.google.com[/TD]
[/TR]
[TR]
[TD]N/A[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]External link is http://mynah.sbc.com (outside)[/TD]
[TD]http://mynah.sbc.com[/TD]
[/TR]
[TR]
[TD]NOT VALID[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1 PROD
2 TEST http://www.text.com[/TD]
[TD]http://www.text.com[/TD]
[/TR]
[TR]
[TD]ERROR[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]