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
• 38,020 points
1,410 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
• 63,680 points

Related Questions In Others

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
• 63,680 points
1,944 views
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
• 63,680 points
1,181 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

VBA SharePoint macro

I believe you are attempting to open ...READ MORE

answered Feb 14, 2023 in Others by Kithuzzz
• 38,020 points
1,983 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
1,177 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
3,630 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
• 23,260 points
878 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
• 63,680 points
2,026 views
0 votes
1 answer

Is there a way to produce a sum according to date/time stamp values of another column on excel?

Assuming the input data for the second ...READ MORE

answered Mar 25, 2023 in Others by narikkadan
• 63,680 points
593 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