Is there a way to lock cells after editing an excel sheet that s on sharepoint

0 votes

Is it possible to lock cells in an Excel sheet on Sharepoint once a user enters data? On Excel, I can lock the cells, but not on Sharepoint. Basically, when you enter data into the Excel app, it doesn't lock cells the way it does on Sharepoint.

Is there work for this? I've already tried the VBA code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim xRg As Range
    On Error Resume Next
    Set xRg = Intersect(Range("A1:G800"), Target)
    If xRg Is Nothing Then Exit Sub
    Target.Worksheet.Unprotect Password:="saag"
    xRg.Locked = True
    Target.Worksheet.Protect Password:="saag"
End Sub

It doesn't work the same way as you'd expect when someone inputs data on share point.

enter image description here

Oct 3, 2022 in Others by Kithuzzz
• 28,900 points
174 views

1 answer to this question.

0 votes
The Excel Web version (which, based on the screenshot, it appears you're using), does not support VBA. If the user accesses the file in their local Excel application, you might be able to make it work depending on the security settings, but it looks destined to be troublesome.

Instead of using the OnEdit event, you might set up a PowerApp script that would work somewhat similarly. Instead of VBA, you would have to use TypeScript. This video is a decent place to start while transitioning. You can activate TypeScript Recorder, record a few operations, and then utilise the Microsoft documentation to observe how various objects, such as range, interact with one another and their properties (value, locked, etc).
answered Oct 3, 2022 by narikkadan
• 53,520 points

Related Questions In Others

0 votes
1 answer

Is there a way to hide excel formula using Apache POI

In Excel, hiding formulae is a feature ...READ MORE

answered Oct 11, 2022 in Others by narikkadan
• 53,520 points
221 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Is there a limit on an Excel worksheet's name length?

The file format would allow worksheet names ...READ MORE

answered Dec 19, 2022 in Others by narikkadan
• 53,520 points
113 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
532 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
2,414 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 22,960 points
117 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,630 points
299 views
0 votes
1 answer

Is there any way in python to auto-correct spelling mistake in multiple rows of an excel files of a single column?

Use Spellchecker for doing your stuff: import pandas ...READ MORE

answered Oct 14, 2022 in Others by narikkadan
• 53,520 points
324 views
0 votes
1 answer

Is there a way in Microsoft Excel to give specific bins different bin widths when making a histogram plot?

Excel built-in histogram tool only allows equal ...READ MORE

answered Oct 2, 2022 in Others by narikkadan
• 53,520 points
164 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP