Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7160377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:23:21+00:00 2026-05-28T13:23:21+00:00

I have a workbook with sheets having names: Student (1), Student (2), Student (3)

  • 0

I have a workbook with sheets having names: Student (1), Student (2), Student (3) and so on.

I am adding a sheet through vba with will be named Student (4) if there are three sheets already present. How can I identify the last sheet number (3 in this case) so I know I need to name the next sheet Student (4)?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:23:22+00:00Added an answer on May 28, 2026 at 1:23 pm

    The code below displays the largest current student number. Is this what you were after?

    Warning. In my experience workbooks become very difficult to use as the number of worksheets increases. I have used one with 40 sheets and found it a nightmare. There is also a theoretical limit of 255 although I told Excel will exceed other limits before it can be reached.

    Option Explicit
    Sub NextSheetName()
    
      Dim NameCrnt As String
      Dim NumCrnt As Long
      Dim NumMax As Long
      Dim Pos As Long
      Dim WkSht As Worksheet
    
      NumMax = 0
    
      For Each WkSht In Worksheets
        NameCrnt = WkSht.Name
        Pos = InStr(1, NameCrnt, "(")
        If Pos = 0 Then
          ' Code to handle non-standard name.
        Else
          NumCrnt = Val(Mid(NameCrnt, Pos + 1, 1))
          If NumMax < NumCrnt Then
            NumMax = NumCrnt
          End If
        End If
      Next
    
      Debug.Print "Largest current student number=" & NumMax
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have more than twenty sheets in an Excel workbook (file). Is there some
I have a excel workbook with two sheets. One sheet is maxed out and
I have a workbook with two sheets. I would like to format the cell
I have an XML document something like ::: <?xml version=1.0 encoding=utf-8?> <?mso-application progid=Excel.Sheet?> <Workbook
I have a workbook with 20 different pivot tables. Is there any easy way
I have an Excel workbook with a number of features: One main user-facing sheet
I have the following code to protect the sheets of a workbook in Excel
I have around 25 worksheets in my workbook (Excel spreadsheet). Is there a way
I have created an excel workbook with many sheets like sheet1, sheet2,... etc. How
Consider the following case: I have a single Excel workbook with 4 sheets in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.