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!
 

sijpie

Well-known Member
Joined
Nov 1, 2008
Messages
3,527
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.
 

sijpie

Well-known Member
Joined
Nov 1, 2008
Messages
3,527
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
 

Forum statistics

Threads
1,082,316
Messages
5,364,483
Members
400,802
Latest member
RichBRich

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top