excelschlub
New Member
- Joined
- Nov 14, 2017
- Messages
- 16
Hello,
I need to find a way to make the subaddress of my hyperlinks change as rows in my sheet are deleted. Essentially, the code I have below creates a hyperlink on the same line that input from a userform is transferred to. When the user clicks the newly created hyperlink, they move the corresponding line of data from the current sheet to a 'completed items' sheet. My problem is that as lines are moved from one sheet to another, the hyperlinks are continuing to reference their original placement address rather than their current cell address which means that when these hyperlinks are clicked, they are moving the wrong line of data.
I have done reading that suggested referring to a named range will solve my problem, but I'm not sure how to dynamically name each range within the hyperlink creation code. As info, all the hyperlinks have the same name, but each has a unique address. Again, the code that creates the hyperlink once the userform is shown below.
As usual, I'm up for any ideas you may have. Many thanks!
-Dave
I need to find a way to make the subaddress of my hyperlinks change as rows in my sheet are deleted. Essentially, the code I have below creates a hyperlink on the same line that input from a userform is transferred to. When the user clicks the newly created hyperlink, they move the corresponding line of data from the current sheet to a 'completed items' sheet. My problem is that as lines are moved from one sheet to another, the hyperlinks are continuing to reference their original placement address rather than their current cell address which means that when these hyperlinks are clicked, they are moving the wrong line of data.
I have done reading that suggested referring to a named range will solve my problem, but I'm not sure how to dynamically name each range within the hyperlink creation code. As info, all the hyperlinks have the same name, but each has a unique address. Again, the code that creates the hyperlink once the userform is shown below.
Code:
ActiveSheet.Hyperlinks.Add anchor:=Cells(NextRow, 11), _
Address:="", _
SubAddress:="'" & Sheet16.Name & "'!" & Cells(NextRow, 11).Address, _
TextToDisplay:="Mark as Complete"
As usual, I'm up for any ideas you may have. Many thanks!
-Dave