Dynamic Hyperlink VBA

user125

New Member
Joined
Feb 20, 2020
Messages
31
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have a question regarding making a hyperlink dynamic. Below I have posted my code that I have so far. I want to make the hyperlink in a way where the sub address directs me to cell "ws.Range("E" & count).value". The cell keeps changing as it keeps looping and hence I want to do the same with my hyperlink. Thanks in advance! :)
VBA Code:
Public Sub tatrigger(ws As Worksheet)

    Dim i As Long
    Dim x As Long
    Dim lastRow As Long
    Dim first As Long
    Dim last As Long
    Dim count As Long
    
    Application.ScreenUpdating = False
    
    lastRow = ws.Cells(Rows.count, "C").End(xlUp).Offset(2, 0).row
    first = ws.Range("Trigger_Table").row
    last = ws.Cells(Rows.count, "C").End(xlUp).Offset(-1, 0).row
    
    'looks for tip and copies task name, task descrption, umbrella into bulk add (regardless of duplicates)
    
    For count = first To last
        If ws.Range("C" & count).value = "ta" Then
            ws.Range("E" & count).Copy
                For i = lastRow To lastRow
                    ws.Range("C" & i + x).PasteSpecial Paste:=xlPasteValues
                    'ActiveCell.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=ws.Range("E" & count)
                    ws.Range("C" & count).value = "ta- added to takeaways"
                Next i
                x = x + 1
        End If
    Next count
    
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
cross posted here:
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,565
Members
449,089
Latest member
Motoracer88

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