Create new tab with a template, locking old one when completed

JonoRig

New Member
Joined
Aug 6, 2015
Messages
7
Hi All,

I am attempting to create an archiving system for work and having some trouble finding a way to do a certain thing because I'm not sure how to word it for the searches...

So, we have an archiving system, which is a 9 x 9 box for samples (81 samples); on the worksheet so far i have a visual representation of the box using some magical VBA stuff I found years ago, where when an archive position is filled it goes from Red to Green. I have locked the work sheet so only the column with sample ID, Initials of who archived and date can be entered.

What i would like to do next is when they fill in all 81 spaces, the worksheet locks the tab, to prevent editing without my password, creates a new tab at the front of the worksheet (so the numbers will go in descending order, from the in-use box down to 1, eg 34, 33, 32... 1), with the blank version of the 81 spaces, and automatically renames the tab to the next number (Box 2, Box 3 etc).

Does anyone know what i can do to make this work?

Thank you!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi JonoRig,

this is fairly simply done.

I would advise that you make a template sheet of an empty box. You give it a name on the tab , say 'Template'. You can hide this template once it is made.
 
Upvote 0
Clicked on the wrong button.

Before you start adding code etc, create a copy of your live workbook and code in this copy, so you won't screw up your archive! Once done you can move your archived boxes to the coded workbook

Your code would follow the following steps:

  1. Detect that the last slot is filled
  2. Close the tab
  3. Copy the template
  4. Rename this copy

Of course this involves a bit of coding.

1. Detect the last slot is filled
In essence you would really like to protect each slot once it is filled.
Then when the last slot is filled the code to make a new box is run.

To detect changes in a worksheet, you have to create code in the worksheet module.
Here you can select a worksheet_change sub, where you can check which cell has been changed, and then act on it accordingly

But to do any real coding, I would need to know the layout of your box sheet. And what is being entered in each cell?/block
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

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