Locking down an excel sheet.

MasterBash

Board Regular
Joined
Jan 22, 2022
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I am trying to build an excel form that visitors will be filling out. The data on that form will be sent to the Visitor data sheet on Submit. Old data will be sent to Archive and the Information sheet simply gives information about e-mails, data validation, support link, etc...


sheets.png


The registration form will be filled by people we do not know. We want to make sure that they won't have access to other sheets, vba (even if the sheet contains vba, we just don't want them to mess with the code or anything). We don't want them to be able to change anything. All they should be allowed to do is to fill out this form and click submit/clear. However, the team needs access to the other sheets.

We have not decided how we will be doing this, but there are 2 different ways I can think of :
A windows tablet, where this sheet will run the Excel app and the rest of us will be running the web version of the app.

A laptop with a tablet connected to it acting as a second screen.

How would we go about securing our data and to make sure that people are unable to break the form or anything ?

Thank you.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Seems to me like Microsoft Forms would have been a simpler implementation for a guest entry form.
 
Upvote 0
Thank you. I heard about the Google forms but after trying it out, we chose not to use it. I never heard of Microsoft forms, but I will test it out this week.
 
Upvote 0
Sorry, it took a while to reply to this, as we did test things out and we tried Microsoft forms and google forms but we could not (easily) get a signature on those forms, so we ended up using :

VBA Code:
Private Sub Workbook_Open()
'I use this for every macro, so they can't be run using alt-f8 :
If Not Environ("username") = "usernamehere" Then
MsgBox "You are not authorized to do this."
Exit Sub
End If

If ActiveSheet.Name = "Registration form" Then

    Application.OnKey "{ESC}", ""
Else
    Application.OnKey "{ESC}"
End If

ThisWorkbook.Unprotect "passwordhere"
Worksheets("Registration form").Select
'This one is actually good to write data with vba to locked cell :
Worksheets("Registration form").Protect UserInterfaceOnly:=True
Worksheets("Registration form").ScrollArea = "A1:C23"
Application.DisplayFullScreen = True
Application.DisplayFormulaBar = False
ActiveWindow.DisplayWorkbookTabs = False
ActiveWindow.DisplayHeadings = False
ActiveWindow.DisplayGridlines = False
Worksheets("Visitor data").Visible = xlVeryHidden
Worksheets("Information").Visible = xlVeryHidden
Worksheets("Archive").Visible = xlVeryHidden
ActiveWindow.DisplayHorizontalScrollBar = False
ActiveWindow.DisplayVerticalScrollBar = False
ThisWorkbook.Protect "passwordhere"
Conditions.Show
End Sub

This one so they can't easily close excel :
VBA Code:
Sub CloseMacro()
   Ok2Close = True
   ThisWorkbook.Close SaveChanges:=True
        Application.Quit
    Ok2Close = False
End Sub

No problem so far. We tested it for a a bit and it can become terribly annoying with all the cell validations and stuff, as it should be. Maybe it is not foolproof, as we left some options such as resizing and minimizing, in case we need to fix some stuff on the tablet.

One thing I would like to know :
VBA Code:
If Not Environ("username") = "usernamehere" Then
MsgBox "You are not authorized to do this."
Exit Sub
End If

Is it possible to make it into a range of cells in a sheet, so we can easily add/remove usernames ?
 
Upvote 0
Solution
Hello,
Everything else is working great, but I am still looking for an answer to the question above. I would like to make a list using a range of cells of authorized users to access some macros. (Lets say A1 to A5 on an hidden sheet).

VBA Code:
If Not Environ("username") = "usernamehere" Then
MsgBox "You are not authorized to do this."
Exit Sub
End If

Is it possible to do that ?
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,182
Members
452,615
Latest member
bogeys2birdies

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