PDA

View Full Version : Please password protect my file



rachell_8
08-10-2010, 08:25 PM
Hi, I'm just a newbie here.. Could someone please help me password protect my file without destroying the drop-downs and macro.. i need the yellow fields to remain unprotected so other users can be allowed input. Thanks in advance!

Bob Phillips
08-11-2010, 12:04 AM
Didn't I do that previously?

Have you tried Googling it?

rachell_8
08-11-2010, 12:40 AM
hi xld. actually i noticed that when we hid the index tab, the macro for my row 12 (Vendor Account Group) which supposedly changes the choices available depending on the country i choose-does not work. i dont know if it's because my data for the combo box are on the INDEX tab. Kindly have a look again please. here's the original file i sent on the separate thread i posted.

http://www.vbaexpress.com/forum/showthread.php?t=33519

on the file you returned on your reply, the macro for row 12 does not work anymore.. :(

Bob Phillips
08-11-2010, 01:12 AM
That is a completely different question!

I can see that your dropdowns refer to macros in the original, which I didn't spot yesterday, but none of those macros exist, so the selection triggers nothing, which is what I found on testing and why I thought they were just data selections. In other words, the code isn't there!

rachell_8
08-11-2010, 03:03 AM
oh alright.. that is weird.. so could you help me with my problem? i know this is just simple for experts like you and im a total VBA dummy so please forgive me if I may seem naive to you.. :)

Bob Phillips
08-11-2010, 03:32 AM
The code that is in the file, even though nothing seems to call it, just seems to build a dependent list. Why don't you just use INDIRECTed lists as you have elsewhere?

rachell_8
08-11-2010, 03:48 AM
hmmm.. i'l go ahead and give it a try.. thanks for that!

by the way, is there a way where a message box will appear in case some of the cells will not be filled-out completely by the user? like for example, i want specific cells to be like required fields and the user will not be able to save the file unless these required fields are all completely filled-in?

Bob Phillips
08-11-2010, 05:27 AM
You will need to trap the BeforeSave event for that.

rachell_8
08-12-2010, 03:01 AM
how do i do that? :dunno

Bob Phillips
08-12-2010, 03:32 AM
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)

On Error GoTo wb_exit
Application.EnableEvents = False

'change the following code to apply to your sheet/fields
With Worksheets("Sheet1")

If .Range("A1").Value2 = "" And .Range("H5").Value = "" Then

Cancel = True
End If
End With
wb_exit:
Application.EnableEvents = True
End Sub


This is workbook event code.
To input this code, right click on the Excel icon on the worksheet
(or next to the File menu if you maximise your workbooks),
select View Code from the menu, and paste the code

rachell_8
08-12-2010, 03:49 AM
thank you so much!