Saving Column with Hyperlink Function as a Hyperlink

J Harper

New Member
Joined
Jun 3, 2021
Messages
17
Office Version
  1. 365
Platform
  1. Windows
I have created a column of active hyperlinks using the HYPERLINK FUNCTION. I need a column of active hyperlinks without using the HYPERLINK FUNCTION. I have tried PASTE SPECIAL and cannot same the active link.

How can I copy the column and save as an active hyperlink without using the HYPERLINK FUNCTION?

UNACTIVATED FILE PATHACTIVATED FILE PATH USING HYPERLINK FUNCATION; EXAMPLE: HYPERLINK (A2)NEED ACTIVATED PATH WITHOUT USING HYPERLINK FUNCTION
C:\users\downloads\temp\test_folder_dch\test 1.pdfC:\users\downloads\temp\test_folder_dch\test 1.pdf
C:\Users\downloads\temp\test_folder_dch\test 2.pdfC:\Users\downloads\temp\test_folder_dch\test 2.pdf
C:\Users\downloads\temp\test_folder_dch\test 3.pdfC:\Users\downloads\temp\test_folder_dch\test 3.pdf
C:\Users\downloads\temp\test_folder_dch\test 4.pdfC:\Users\downloads\temp\test_folder_dch\test 4.pdf

 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
How about using a function/formula?

VBA Code:
Public Function GetURL(Cel As Range) As String
    On Error Resume Next
    GetURL = Cel.Hyperlinks(1).Address
End Function

Then in a blank cell put the formula:
=GetURL(B1)

B1, in this case, would be to extract link from hyperlinked cell B1
 
Upvote 0
Currently there are NO HYPERLINKED CELLS (COLUMN A). COLUMN A is only text. I can open TEST 1.PDF by using the HYPERLINK FUNCTION in COLUMN B. BUT I need for COLUMN C to the ACTIVATED FULL PATH LINK to the pdf without going to each cell and putting in the link.
C:\users\downloads\temp\test_folder_dch\test 1.pdf
COLUMN A
COLUMN B
COLUMN C
C:\users\downloads\temp\test_folder_dch\test 1.pdf=Hyperlink(A1)C:\users\downloads\temp\test_folder_dch\test 1.pdf
C:\users\downloads\temp\test_folder_dch\test 2.pdf=Hyperlink(A2)C:\users\downloads\temp\test_folder_dch\test 2.pdf
 
Upvote 0
@J Harper, Can I ask why you don't want to use the commonly accepted hyperlink approach? Do you think that would take a long time to do =Hyperlink(A1) ... =Hyperlink(A2) ... etc?
 
Upvote 0
If you just want to convert the text in Column A to clickable links, then you just need to select the range in Column A that you want to convert and then run the following vba macro code:

VBA Code:
Public Sub ConvertSelectedRangeToHyperlinks()
'
    Dim Cell As Range
'
    For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
        If Cell <> "" Then
            ActiveSheet.Hyperlinks.Add Cell, Cell.Value
        End If
    Next
End Sub

What exactly is your goal?
 
Upvote 0
The commonly used accepted hyperlink approach using =Hyperlink(A1) ... =Hyperlink(A2) ... etc doesnt seem to work. I need to be able read the column and perform a FILECOPY. The "normal approach" as noted in COLUMN B gives an error. SO, I think i need COLUMN C with the fully designated hyperlink. The MACRO that I am using is listed below. The MACRO works when I manually add the full path BUT DOES not work using COLUMN B with the "normal approach" as it was called above. I listed the MACRO that I am using below.

COLUMN ACOLUMN BCOLUMN CCOLUMN D (New file name that will be "filecopied" to C:\files\pdfs\
C:\users\downloads\temp\test_folder_dch\test 1.pdf=Hyperlink(A1)C:\users\downloads\temp\test_folder_dch\test 1.pdfNew File Name 1.PDF
C:\users\downloads\temp\test_folder_dch\test 2.pdf=Hyperlink(A2)C:\users\downloads\temp\test_folder_dch\test 2.pdfNew File Name 2.PDF

MACRO
Public Sub Copy_Hyperlinked_Files()
Dim destFolder As String
Dim lastRow As Long, r As Long
destFolder = "C:\files\pdfs\"
If Right(destFolder, 1) <> "\" Then destFolder = destFolder & "\"
With ActiveSheet
lastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For r = 2 To lastRow
FileCopy .Cells(r, "B").Hyperlinks(1).Address, destFolder & .Cells(r, "D").Value & ".pdf"
Next
End With
 
Upvote 0
Sorry, I am still confused on what your goal is.

It sounds like you want to copy a file from a path that is designated in a cell, to a new location. I am confused on why the need for hyperlinks or active links just to copy a file?
 
Upvote 0
I assumed that I needed to link, if i simply have the name of the file will that work?
 
Upvote 0
Yes

So change:

VBA Code:
lastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For r = 2 To lastRow
FileCopy .Cells(r, "B").Hyperlinks(1).Address,

to just:

VBA Code:
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For r = 2 To lastRow
FileCopy .Cells(r, "A"),
 
Last edited:
Upvote 0
Solution
So if I simply want to FILECOPY files in the folder "C:\users\o10339\downloads\temp\test_folder_dch\" (COLUMN C) as noted in spreadsheet below to a new folder that is designated in MACRO (i.e. C:\files\pdfs\), with the file name from COLUMN B?

By the way, I will not know the number of rows and need the process to continue until the last row.


MACRO (What should change based on explanation above)
Public Sub Copy_Hyperlinked_Files()
Dim destFolder As String
Dim lastRow As Long, r As Long
destFolder = "C:\files\pdfs\"
If Right(destFolder, 1) <> "\" Then destFolder = destFolder & "\"
With ActiveSheet
lastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For r = 2 To lastRow
FileCopy .Cells(r, "B").Hyperlinks(1).Address, destFolder & .Cells(r, "D").Value & ".pdf"
Next
End With
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,298
Members
449,077
Latest member
Rkmenon

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