Zanatos1986
New Member
- Joined
- Apr 15, 2010
- Messages
- 48
I am writing code from a drop down box to add a new sheet to my workbook, expand upon a name and change properties of the new sheet.
I am on a sheet labeled "GTS Addition", on this page I have a dropdown list and a blank box to inset my info.
Dropdown List ($N$10) Options - X, Y
Blank Box ($N$12)
My code currently adds a new sheet with the name of the blank box. I need to change the color of the tab based upon the name of the dropdown list, I also need to add the name in the blank box to a predefined list on the main page "GTS Library"
I have listed my code below, I have tried several things but I am just not getting anywhere. All help is appreciated
I am on a sheet labeled "GTS Addition", on this page I have a dropdown list and a blank box to inset my info.
Dropdown List ($N$10) Options - X, Y
Blank Box ($N$12)
My code currently adds a new sheet with the name of the blank box. I need to change the color of the tab based upon the name of the dropdown list, I also need to add the name in the blank box to a predefined list on the main page "GTS Library"
I have listed my code below, I have tried several things but I am just not getting anywhere. All help is appreciated
Code:
' Add Company
Private Sub CommandButton2_Click()
Dim AddAsLastWorksheet()
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = Range("$N$12").Value
If Range($n$10).Value = X Then
With ActiveWorkbook.Sheets("Test").Tab
.Color = 10498160
.TintAndShade = 0
End With
End If
If Range($n$10).Value = Y Then
With ActiveWorkbook.Sheets("Test").Tab
.Color = 5287936
.TintAndShade = 0
End With
End If
End Sub