Hyperlinks in unprotected cells in Protected Worksheets using VBA

Detectiveclem

Active Member
Joined
May 31, 2014
Messages
320
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Hi I am having problems inserting Hyperlinks in unlocked cells on protected worksheets.

With the help of this forum I have been successfully using the code below to auto filter

However, I have noticed after this code is run, I am unable to insert a hyperlink in the unlocked cells. I have tried selecting the option to allow Hyperlinks in the unlocked cells but as soon as the following code is run the option to insert hyperlink is greyed out.

I would appreciate any help in resolving this issue


Sub LiveDan()
'
' LiveDan Macro
'
ActiveSheet.Unprotect Password:="????????"
'
ActiveSheet.Range("$B$16:$U$2006").AutoFilter Field:=6, Criteria1:= _
"<>*Completed*", Operator:=xlAnd, Criteria2:="<>*Cancelled*"

ActiveSheet.Protect Password:="?????????"
End Sub
Sub AllcontractsGina()
'
' AllcontractsGina Macro

ActiveSheet.Unprotect Password:="?????????"
'
'
ActiveSheet.Range("$B$16:$U$2006").AutoFilter Field:=6
ActiveSheet.Protect Password:="??????????"
End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
If you record a macro whilst you protect the sheet, it will give you the code you need.
 
Upvote 0
If you record a macro whilst you protect the sheet, it will give you the code you need.

Thanks Fluff, do you mean the whole macro or just the password bit with hyperlink being enabled....

Thanks
 
Upvote 0
Just the password bit. When protecting the sheet there are multiple arguments you can supply that will determine what you can & can't do.
 
Upvote 0
Just the password bit. When protecting the sheet there are multiple arguments you can supply that will determine what you can & can't do.

The code appears to be

AllowinsertingHyperlinks:=True

but I am not sure where into my code it should be added.
 
Upvote 0
You should have ended up with something like this (depending on what you selected)
Code:
    ActiveSheet.Protect [COLOR=#ff0000][/COLOR]DrawingObjects:=True, Contents:=True, Scenarios:= _
        False, AllowInsertingHyperlinks:=True, AllowFiltering:=True[COLOR=#ff0000]
[/COLOR]
All you need to do is copy everything after the word protect & add it to your code after the password
 
Upvote 0
Thank you Fluff, I will try this tomorrow and let you know how I get on.

Really appreciate all your assistance.
 
Upvote 0
You're welcome

Hi Fluff,

Just used your suggested code and it works perfectly. I really appreciate your help with this. VBA still baffles me, but I like the results.

Cheers,

Paul
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

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