PDA

View Full Version : Complicated VBA



reasonancefa
11-18-2018, 03:35 PM
HI all

I need some (actually a lot of help) with Excell

When I open a workbook lets call it workbookA it should automatically have n few sheets locked and then some unlocked (SheetA, SheetB has to be locked SheetC and SheetD has to be unlocked) this is no problem with protect workbook/sheet I just want to give as much information as possible

Where the VBA kicks in. Every time this workbook gets opened it has to get a new number in cellA1 (Example: If I open workbookA in cellA1 is a number 1, Now if I save and open it again cellA1 sould be 2). Now lets make it more complicated. I need n template using this code. When I open the template it wil change the cellA1 to 2 and if I save as to n new file and close, Open this template again It has to have CellA1 change to 3.

I also need n code that wont allow me to save until I fill in certain fields say CellA2 and CellA3

When I save then The entire workbook should automatically be protected so no one can change n thing. After the save only I can have the ability to change some stuff with the password.

Sorry if I confused you. I will be happy to answer all question

Thank you in advance

Good luck

Aussiebear
11-18-2018, 07:15 PM
Name Cell A1 as 'Counter" and set value to 0, then add the following section of code


Private Sub Workbook_Open()
[Counter].Value = [Counter] + 1
End Sub

Everytime you open the workbook the count value should increase by 1