Stop user from Deleting hyperlinks on sheet

sean1541

New Member
Joined
Feb 14, 2023
Messages
31
Office Version
  1. 2016
Platform
  1. MacOS
How can i stop other users from deleting hyperlinks from the sheet.
When i protect the sheet, they can't use the hyperlink
any help would be great thanks
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Are the hyperlinks in a specific part of the sheet?
If so, can you tell us what that is?

I am thinking that you may be able to use VBA in order to immediately undo any deletions to specific ranges on your sheet.
 
Upvote 0
Are the hyperlinks in a specific part of the sheet?
If so, can you tell us what that is?

I am thinking that you may be able to use VBA in order to immediately undo any deletions to specific ranges on your sheet.
all in column D
 
Upvote 0
Something like this would prevent a user from deleting single cells in column D.
(Right-click on the sheet tab name at the bottom of the screen, select "View Code", and paste this code in the VB Editor window that pops up):
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

'   Exit if multiple cells updated at once
    If Target.Count > 1 Then Exit Sub
   
'   Exit if update not to column D
    If Target.Column <> 4 Then Exit Sub
   
'   Exit if if cell not cleared out
    If Target.Value <> "" Then Exit Sub
   
'   Undo deletion
    Application.EnableEvents = False
    Application.Undo
    Application.EnableEvents = True
   
End Sub
 
Upvote 1
Solution
Note: It looks like this may be unnecessary. It appears if you select the right protection options, you should be able to protect the cells from being deleted, but the hyperlinks should still work.
See here: Redirecting
 
Upvote 0
Something like this would prevent a user from deleting single cells in column D.
(Right-click on the sheet tab name at the bottom of the screen, select "View Code", and paste this code in the VB Editor window that pops up):
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

'   Exit if multiple cells updated at once
    If Target.Count > 1 Then Exit Sub
  
'   Exit if update not to column D
    If Target.Column <> 4 Then Exit Sub
  
'   Exit if if cell not cleared out
    If Target.Value <> "" Then Exit Sub
  
'   Undo deletion
    Application.EnableEvents = False
    Application.Undo
    Application.EnableEvents = True
  
End Sub
Works great thanks
 
Upvote 0
You are welcome.
Also note the follow-up post I made, which shows it may not even be necessary.
 
Upvote 0
I have tried that when I protect sheet I cannot use a hyperlink.
That is weird, it works just fine for me.
Are you sure that you have the "Select locked cells" box checked?

1712316275656.png


If so, maybe it is something that behaves differently on a Mac (I use Windows).
 
Upvote 0

Forum statistics

Threads
1,215,196
Messages
6,123,578
Members
449,108
Latest member
rache47

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