+ Reply to Thread
Results 1 to 4 of 4

how do i get the name of a newly added sheet that i add with Sheets.Add in a vba macro in excel?

  1. #1
    Alex
    Guest

    RE: how do i get the name of a newly added sheet that i add with Sheet

    Daniel

    This is one way, but maybe not wholly satisfactory...this is a starting
    point (maybe) and you can tweak it...

    Sub getShtName()
    Dim shtCount As Integer
    Dim newSht As String
    shtCount = Worksheets.Count
    Sheets.Add.Move After:=Sheets(shtCount)
    newSht = Worksheets(shtCount + 1).Name
    End Sub

    This places a new sheet at the end and then gets the name of it.

    "Daniel" wrote:

    > how do i get the name of a newly added sheet that i add with Sheets.Add in a
    > vba macro in excel?
    >
    >
    >


  2. #2
    Alex
    Guest

    RE: how do i get the name of a newly added sheet that i add with Sheet

    Daniel

    This is one way, but maybe not wholly satisfactory...this is a starting
    point (maybe) and you can tweak it...

    Sub getShtName()
    Dim shtCount As Integer
    Dim newSht As String
    shtCount = Worksheets.Count
    Sheets.Add.Move After:=Sheets(shtCount)
    newSht = Worksheets(shtCount + 1).Name
    End Sub

    This places a new sheet at the end and then gets the name of it.

    "Daniel" wrote:

    > how do i get the name of a newly added sheet that i add with Sheets.Add in a
    > vba macro in excel?
    >
    >
    >


  3. #3
    Daniel
    Guest

    how do i get the name of a newly added sheet that i add with Sheets.Add in a vba macro in excel?

    how do i get the name of a newly added sheet that i add with Sheets.Add in a
    vba macro in excel?



  4. #4
    Alex
    Guest

    RE: how do i get the name of a newly added sheet that i add with Sheet

    Daniel

    This is one way, but maybe not wholly satisfactory...this is a starting
    point (maybe) and you can tweak it...

    Sub getShtName()
    Dim shtCount As Integer
    Dim newSht As String
    shtCount = Worksheets.Count
    Sheets.Add.Move After:=Sheets(shtCount)
    newSht = Worksheets(shtCount + 1).Name
    End Sub

    This places a new sheet at the end and then gets the name of it.

    "Daniel" wrote:

    > how do i get the name of a newly added sheet that i add with Sheets.Add in a
    > vba macro in excel?
    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1