Trying to extract URL and get it in correct order

NoobofVBA

New Member
Joined
Oct 1, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am very new to VBA and I would like to understand how can I get this information in a "readable" URL format from this jumbled code. (pic below).

As you can see the https:// is at the end and the other part is at the beginning. I have tried TEXT to Columns and separated it by " and it does format but breaks it over several columns. I would like to be able to have some type of code (instead of doing this manually which does work by the way if I make it like pic 2) that I could use after I extract the information from SharePoint to remove everything and then create the URL in the correct format (overwriting in the same column), is this possible?

the raw data (pic 1)
Screenshot 2024-09-30 145459.png


And what I would like it to look like. (pic2)

Screenshot 2024-09-30 150048.png
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Can you give that to us in some sort of text format so that we don't have to retype all that?
Even if it's just copying and pasting from your sheet?
 
Upvote 0
No problem Scott.

Here you go.

{"fileName":"photo.jpg","serverRelativeUrl":"/sites/MicrosoftSpring2026/SiteAssets/Lists/f237a6c1-4ff6-41d0-abe2-09c6002c8996/Erics%20Failure.jpg","id":"3cc097c1-1309-486c-aa6c-4357cecc5efe","serverUrl":"https://microsoft.sharepoint.com","thumbnailRenderer":null}
 
Upvote 0
Try to use such a function:
VBA Code:
Function ExctractURL(sInput) As String
    Dim v As Variant
    Dim T1 As String
    Dim T2 As String
    
    On Error Resume Next
    v = Split(sInput, ",")
    
    T1 = Trim(Split(v(3), "serverUrl"":""")(1))
    T1 = Trim(Left(T1, Len(T1) - 1))
    
    T2 = Trim(Split(v(1), "serverRelativeUrl"":""")(1))
    T2 = Trim(Left(T2, Len(T2) - 1))
    
    ExctractURL = T1 & T2
End Function
Artik
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,195
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top