Adding hyperlink to a cell within a with statement

DanSMT

Board Regular
Joined
Sep 13, 2019
Messages
203
Office Version
  1. 2013
Platform
  1. Windows
Hello all,

Im struggling with this one. Im tring to add a hyperlink the a cell within a with statement.

Heres what im trying to do. I have textbox in a userform that has a number in it. The number is used to search a workbook for a matching number. The macro then finds the row the cell is in. I then want to place a hyperlink in cell column "AE" of the same row that was found.

Linked below is my attempt at the code, not sure what im missing or doing wrong.

Any help is greatly appreciated.

VBA Code:
Dim Fd1 As FileDialog

Set Fd1 = Application.FileDialog(msoFileDialogFolderPicker)
With Fd1
.AllowMultiSelect = False
.Title = "Please Select Customers RGA Folder"
If .Show = True Then

strPath2 = .SelectedItems(1) & "\"
MkDir (strPath2 & "RGA " & TextBox1.Value & "\")
strPath3 = strPath2 & "RGA " & TextBox1.Value & "\"
Else
GoTo skip1:
End If
End With


For Each ws2 In wb1.Worksheets
        Set FoundCell = ws2.Columns(1).Find(What:=UserSearch, LookIn:=xlValues, LookAt:=xlWhole)
        If Not FoundCell Is Nothing Then
        Application.Goto FoundCell, True
        Hyperlinks.Add anchor:=Range("AE" & ActiveCell.Row).Value, _
        Address:=strPath3, TextToDisplay:=strPath3
        End If
Next ws2
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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