VBA code to copy Master worksheet Values and rename to current date then hide / protect the sheet

Anonymous
2018-02-09T05:40:11+00:00

Hi

I'm entirely new to VBA coding I'm creating a my first macro. This file is designed to keep track of 100+ individuals historical data. all work will be completed on one sheet called "Master"

I want the macro to copy values from "Master" and rename the copy with the current date. The following macro does just that although without any protection.

Sub BackupMaster()

    Worksheets("Master").Copy Before:=Worksheets("Master")

        With ActiveSheet.UsedRange

            .Value = .Value

            End With

    ActiveSheet.Name = Format(Date, "MMM-DD-YYYY")

End Sub

I am unsure how to set up error protection, any advice would be greatly appreciated.

I have 2 other Quality of Life features I would like but are entirely optional.

hhmmss in active sheet name

Password protect the new sheet in a manner information can be pulled from the sheet but not altered.

Thanks again.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Anonymous
    2018-02-09T15:07:31+00:00

    Thank you very much.  Worked like a charm.

    Was this answer helpful?

    0 comments No comments