VB Forms

jsambrook

Board Regular
Joined
Feb 1, 2010
Messages
214
I have a list of data that I can open as a form. I would like to run a macro to request the user inserts data into the form. However, I dont want them to have to go to "New" and then insert the data. Is there a way to open the form at a New record? I also dont want them to be able to alter any of the existing data.
Thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Not altering the existing data is the easy part. Just lock the spreadsheet with a password and the user can't change it.
However when you want to change the sheet (through the macro) yu will first need to unlock the sheet, add the new data, and the lock the sheet again.

Code:
private const MySheetPW = "DadiDah"
 
Sub test()
 UnProtectSheet Worksheets("Sheet1")
End Sub
 
Sub ProtectSheet(WS As Worksheet)
    With WS
        .Protect Password:=MySheetPW, DrawingObjects:=True, _
            Contents:=True, Scenarios:=True, _
            userinterfaceonly:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
    End With
End Sub
 
Sub UnProtectSheet(WS As Worksheet)
    WS.Unprotect Password:=MySheetPW
End Sub

But I am not sure what you mean with your first request that the user does not need to got to 'New'. How should Excel then decide to open the userform. Or is it always open as soon as the workbook opens? But then how cna the user do anything useful with the data once it is entered. More explanation please
 
Upvote 0

Forum statistics

Threads
1,224,594
Messages
6,179,792
Members
452,942
Latest member
VijayNewtoExcel

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