Macro to insert or remove template in same sheet tied to a checkbox

SquareJerBear

New Member
Joined
Jan 27, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I am a VBA novice, so any help is much appreciated.

I am trying to help a charge nurse come up with a better way to update the cardex for different patients, other than just using pencil and paper.

What I would like to have happen is this:

The nurse would open an excel workbook that has a main sheet. That sheet would have a checkbox for each room. When you click that box, a page from a separate template is added inline, that is, on the same worksheet.

The nurse would fill out the info for that patient, and update it. Then when the patient leaves, she unchecks the box for that room, and that page is removed. A new patient arrives, and then she checks the box again. The template is re-added, but is once again blank.

For ease of use, I would like for there to be some way for it to stay in order.

I have researched for a few days, found something like this:

VBA Code:
Sub copy_Sheet()
    Dim wb As Workbook
    Dim activeWB As Workbook
    Dim FilePath As String
    
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    
    Set activeWB = Application.ActiveWorkbook
    FilePath = "D:\General Required Docs\DATA.xlsm"

    On Error Resume Next
    Set wb = Application.Workbooks.Open(FilePath)
    wb.Worksheets(1).Copy After:=activeWB.Sheets(activeWB.Sheets.Count)
    activeWB.Activate
    wb.Close False
    
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
End Sub

This would work for someone like me, but the staff aren't that computer savvy. My goal is to make it accessible for staff with a lower level of comfort with Excel.

Does anyone have any suggestions for how to do this in VBA, or if not, if I should pursue something else?

Thanks!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,215,840
Messages
6,127,217
Members
449,370
Latest member
kaiuuu

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