Hyperlink formula and Copy & Pasting the result

Bullpen

New Member
Joined
Jul 19, 2011
Messages
48
Hey everyone. I'm hitting my head against a wall and could use your collective help. I need to create hyperlinks to 200 tickets from our company's OSS. I want to put the link to that ticket, via the ticket name, in a spreadsheet. I can't figure out how to copy the results of a hyperlink function into another spreadsheet because the hyperlink function is referencing other cells due to a concatenation. I've pasted a portion of my sheet below and attempted to explain what is in each of my columns below. Any help you can offer is greatly appreciated.

Column A: URL (always the same)
Column B: Ticket #
Column C: Concatenates the URL with the ticket number because combined, that is the full URL to get to each ticket
Column D: Hyperlink formula (eg: =HYPERLINK(C2,B2)

Hyperlinks in Excel Help 2023.04.17.xlsx
ABCD
1URLTicket #ConcatenateHyperLink
2https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437782https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377821437782
3https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437783https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377831437783
4https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437784https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377841437784
5https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437785https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377851437785
6https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437786https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377861437786
7https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437787https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377871437787
8https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437788https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377881437788
9https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437789https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377891437789
10https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437790https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377901437790
11https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,1437791https://dashboards.fake.domain/sites/ticket-info.aspx?id=14&page=1&param=number,14377911437791
Sheet1
Cell Formulas
RangeFormula
C2:C11C2=CONCATENATE(A2,B2)
D2:D11D2=HYPERLINK(C2,B2)



I need to be able to take the data in Column D and paste it into another spreadsheet so that when it is pasted, it shows the hyperlinked ticket number.

Thanks in advance.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
To achieve this, you can use a combination of VBA and Excel's native features. Here's a step-by-step guide to create hyperlinks for each ticket and then copy them to another worksheet:

  1. Press Alt + F11 to open the VBA editor.
  2. Click on "Insert" > "Module" to insert a new module.
  3. Paste the following code into the module:


Sub CreateHyperlinks()
Dim wsSource As Worksheet, wsDestination As Worksheet
Dim lastRow As Long
Dim i As Long

Set wsSource = ThisWorkbook.Worksheets("Sheet1") ' Replace "Sheet1" with the name of your source worksheet
Set wsDestination = ThisWorkbook.Worksheets("Sheet2") ' Replace "Sheet2" with the name of your destination worksheet

lastRow = wsSource.Cells(wsSource.Rows.Count, "B").End(xlUp).Row

Application.ScreenUpdating = False

For i = 1 To lastRow
wsSource.Hyperlinks.Add Anchor:=wsSource.Cells(i, "D"), _
Address:=wsSource.Cells(i, "C").Value, _
TextToDisplay:=wsSource.Cells(i, "B").Value
Next i

wsSource.Range("D1:D" & lastRow).Copy
wsDestination.Range("A1").PasteSpecial Paste:=xlPasteAll

Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub


  1. Replace "Sheet1" with the name of your worksheet that contains the URLs and ticket numbers. Replace "Sheet2" with the name of the worksheet where you want to paste the hyperlinked ticket numbers.
  2. Close the VBA editor.
  3. Press Alt + F8 to open the "Macro" dialog box, select CreateHyperlinks, and click "Run".
 
Upvote 0
To achieve this, you can use a combination of VBA and Excel's native features. Here's a step-by-step guide to create hyperlinks for each ticket and then copy them to another worksheet:

  1. Press Alt + F11 to open the VBA editor.
  2. Click on "Insert" > "Module" to insert a new module.
  3. Paste the following code into the module:


Sub CreateHyperlinks()
Dim wsSource As Worksheet, wsDestination As Worksheet
Dim lastRow As Long
Dim i As Long

Set wsSource = ThisWorkbook.Worksheets("Sheet1") ' Replace "Sheet1" with the name of your source worksheet
Set wsDestination = ThisWorkbook.Worksheets("Sheet2") ' Replace "Sheet2" with the name of your destination worksheet

lastRow = wsSource.Cells(wsSource.Rows.Count, "B").End(xlUp).Row

Application.ScreenUpdating = False

For i = 1 To lastRow
wsSource.Hyperlinks.Add Anchor:=wsSource.Cells(i, "D"), _
Address:=wsSource.Cells(i, "C").Value, _
TextToDisplay:=wsSource.Cells(i, "B").Value
Next i

wsSource.Range("D1:D" & lastRow).Copy
wsDestination.Range("A1").PasteSpecial Paste:=xlPasteAll

Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub


  1. Replace "Sheet1" with the name of your worksheet that contains the URLs and ticket numbers. Replace "Sheet2" with the name of the worksheet where you want to paste the hyperlinked ticket numbers.
  2. Close the VBA editor.
  3. Press Alt + F8 to open the "Macro" dialog box, select CreateHyperlinks, and click "Run".
Thank you @excel_learnerz

However, I'm getting a run-time error '5': Invalid procedure call or argument.
Debug.png


I kept everything on Sheet 1 and just created a Sheet2 so that I could test it.

All that seems to happen is that it changes the header of Column D in cell D1 from saying 'HyperLink' to saying 'Ticket #' and hyperlinking it.
 
Upvote 0
I was able to solve this by just copying the data in column D, pasting it into Word, then copy if from Word and paste into a different spreadsheet. So much easier!!
 
Upvote 0
Solution

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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