create a new tab automatically

sbrown64

Board Regular
Joined
Aug 23, 2019
Messages
87
HiI have a list and I have just added a new name to the list. I now go to my main entry sheet and when I go to column F and click the down arrow it appears, so far so good.My question is, is there a way of automatically creating a new tab at the bottom with the new name?RegardsStephen
 
I copied and pasted the code above.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Not Intersect(Target, Range("F2:F100")) Is Nothing Then
If Not Evaluate("isref('" & Target.Value & "'!a1)") Then
Application.ScreenUpdating = False
Sheets.Add(, Sheets(Sheets.Count)).Name = Target.Value
Me.Activate
End If
End If
End Sub

I added this to give it a name
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub CREATE_NEW_TAB()[/FONT]
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Don't add anything to it, just copy the code I supplied & paste into the entry sheets code module.
It will run automatically whenever a cell in the range F2:F100 is changed.
 
Upvote 0
It's not meant to be listed, it's what's called event code & will run automatically.
 
Upvote 0
so i enter the code on the vba page for entry sheets? if i then go to the line and add a new name it will automatically work?

just tried it and nothing happened
 
Last edited:
Upvote 0
How are you entering the names in column F of that sheet?
 
Upvote 0
I created a new name and added it to my lists tab, clicked sort and refresh, went to entry sheet and when I got to column F, I clicked the drop down arrow and selected the new name and then tabbed across to create a new line underneath.
 
Upvote 0
just realised, your code is F2:F100, i am on line 493, so i added a zero to make it 1000 and now it works.

Thank you
 
Upvote 0
Glad you sorted it & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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