+ Reply to Thread
Results 1 to 13 of 13

How to add new sheet and name depend on range of cells?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-07-2017
    Location
    KSA
    MS-Off Ver
    2016
    Posts
    48

    How to add new sheet and name depend on range of cells?

    Hey Exceler
    Could you help me in creating new sheet and rename it depend on cells?

    waiting for your replay

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,079

    Re: How to add new sheet and name depend on range of cells?

    We're gonna need more information than that.
    Sounds like a VBA solution is required.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: How to add new sheet and name depend on range of cells?

    Perhaps this VBA solution

    Sub AddSheets()
        Dim i As Long, lr As Long
        lr = Range("A" & Rows.Count).End(xlUp).Row
        Dim sname As String
        With Sheets("Sheet1")
            For i = 1 To lr
                sname = .Range("A" & i)
                Sheets.Add After:=Sheets(Sheets.Count)
                Sheets(Sheets.Count).Name = sname
            Next i
        End With
    End Sub
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    06-07-2017
    Location
    KSA
    MS-Off Ver
    2016
    Posts
    48

    Re: How to add new sheet and name depend on range of cells?

    Thanks alansidaman but i try the code you make but does not work as i want.

    We're gonna need more information than that.
    Sounds like a VBA solution is required.
    here the excel that contain explanation of what i need

    https://drive.google.com/open?id=0Bw...zVNVV95bXAwa2M

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: How to add new sheet and name depend on range of cells?

    When you provide a worksheet for review, please use the upload function available in the forum.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  6. #6
    Registered User
    Join Date
    06-07-2017
    Location
    KSA
    MS-Off Ver
    2016
    Posts
    48

    Re: How to add new sheet and name depend on range of cells?

    i upload it from manage attachment but when i try to send it it's not coming
    When you provide a worksheet for review, please use the upload function available in the forum.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    06-07-2017
    Location
    KSA
    MS-Off Ver
    2016
    Posts
    48

    Re: How to add new sheet and name depend on range of cells?

    Thanks alansidaman but i try the code you make but does not work as i want.

    We're gonna need more information than that.
    Sounds like a VBA solution is required.
    here the excel that contain explanation of what i need
    Attached Files Attached Files

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: How to add new sheet and name depend on range of cells?

    using your spreadsheet, here is updated code to add a sheet as you have requested.

    Option Explicit
    
    Sub NewSheet()
    Dim c As Range
    Set c = ActiveCell
    Worksheets.Add After:=Sheets(Sheets.Count)
    Sheets(Sheets.Count).Name = c.Text
    End Sub
    As to a template, what do you want the template to look like.

  9. #9
    Registered User
    Join Date
    06-07-2017
    Location
    KSA
    MS-Off Ver
    2016
    Posts
    48

    Re: How to add new sheet and name depend on range of cells?

    Thanks for your solution

    I paste the code in sheet1 (right click) - view code - insert new module - paste
    is it right?
    because when i run it, its create new sheet with only one cell (B1)

  10. #10
    Registered User
    Join Date
    06-07-2017
    Location
    KSA
    MS-Off Ver
    2016
    Posts
    48

    Re: How to add new sheet and name depend on range of cells?

    Hello guys,could any one help me in this problem?
    it is not working well until now

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: How to add new sheet and name depend on range of cells?

    What does this mean. It is unclear to me what you are saying.
    when i run it, its create new sheet with only one cell (B1)
    You have not answered my earlier question
    As to a template, what do you want the template to look like.
    If you don't tell us specifically what you want, we cannot provide you with specific responses. Help us to help you by being clear in your requests.

    Responses like this do not help us to provide you with what you want. We are not mind readers
    it is not working well until now

  12. #12
    Registered User
    Join Date
    06-07-2017
    Location
    KSA
    MS-Off Ver
    2016
    Posts
    48

    Re: How to add new sheet and name depend on range of cells?

    what i mean when i paste the code in my excel sheet and i have fill column B with the names, then i debug the code it will create one page with the last row added.

    for the template when the worksheet has been created i want to find header in the first row. For example, cell A1 "Name" cell B1"Age" C1"mobile Number" etc.

    hope you find it clear now

  13. #13
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,717

    Re: How to add new sheet and name depend on range of cells?

    Here is a revised code based upon your recent request. If you make your request clear with examples in your first post, then that will speed up getting a bona fide response that meets your needs.

    Sub NewSheet()
        Dim c As Range
        Set c = ActiveCell
        Worksheets.Add After:=Sheets(Sheets.Count)
        Sheets(Sheets.Count).Name = c.Text
        With ActiveSheet
            .Range("A1") = "Name"
            .Range("B1") = "Age"
            .Range("C1") = "Mobile Number"
        End With
    End Sub

    For this to work, you must have a cell in the current range of B:B selected as this is prompted off an active cell selected.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula needed to depend formula's range on specified cells
    By VincentNL in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-01-2014, 06:15 AM
  2. need help to copy rows to a new sheet depend on a cell value
    By Aranell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-22-2013, 10:36 AM
  3. Make table size depend on data range
    By andershess in forum Excel General
    Replies: 7
    Last Post: 07-24-2013, 04:03 PM
  4. how to create a list that will depend on the sheet
    By tonnerre2000 in forum Excel General
    Replies: 1
    Last Post: 04-19-2012, 10:47 AM
  5. combine two sheet depend on sequence of first sheet
    By fafa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2012, 07:12 PM
  6. [SOLVED] 'Copy to' Advance Filter depend only on sheet ID not start sheet
    By Sandy Yates in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-03-2006, 10:50 PM
  7. How to show data from other sheet depend on value??
    By Malka in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-27-2006, 05:00 AM

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