Search the Community
Showing results for tags 'Skillz'.
Found 1 result
I made an excel sheet for work for a project we are wanting to present to the higher ups to convince them of its efficacy. Basically it's related to car inspections, and tagging a dollar sign to each inspection. We have the first sheet which is the summary of the day, and the other 16 sheets which represents the 16 vehicles you would check throughout the day. I want to set it so that cell B2 contains the car's model, and said cell becomes the sheet's name once you finish modifying cell B2. I understand I will want to use a Worksheet_Change event, which I have gotten to work, however the issue pops up when I have two cars of the similar make within the same day (aka XLSM file) as it doesn't allow for two sheets to have the same name. So here's my code: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$2" Then Name = [b2].Text End If End Sub What happens when I have two cars with the same make, is the following: Runtime error 1004: Cannot rename a sheet to the same name as another sheet, a reference object library, or a workbook referenced by Visual Basic So what do I do to fix this? Would there be a way to add (2) (Incrementally) after the name IF it gives this error popup? I thought of maybe also adding the car's year in the name but that wouldn't be 100% foolproof as it wouldnt be impossible to get two Civic 2008 in the same day. Thanks for your help guys, hopefully I was clear enough in what I explained above.