1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

copy sheets based on drop down list in cell (+ rename based on cell)

Discussion in 'VBA Macros' started by Manuel998, Aug 10, 2018.

  1. Manuel998

    Manuel998 Member

    Messages:
    65
    Code (vb):
    Sub Copyrenameworksheet()
    'Updateby MR
       Dim ws As Worksheet
        Set wh = Worksheets(ActiveSheet.Name)
        ActiveSheet.Copy After:=Worksheets(Sheets.Count)
        If wh.Range("C3").Value <> "" Then
        ActiveSheet.Name = wh.Range("C3").Value
        End If
        wh.Activate
    End Sub
    Hi - I currently have this script. what i am trying to achieve is to copy the same sheet however I need it to change the tab name and loop to the next name in the drop down list. finally i would also want for the tab name to mirror the cell value in the drop down list.

    upload_2018-8-10_10-22-23.png
  2. Manuel998

    Manuel998 Member

    Messages:
    65
    Hi,

    Would really appreciate if the community can help with this query? Thanks in advance for all your help.
  3. vletm

    vletm Excel Ninja

    Messages:
    3,877
    Manuel998
    Upload a Sample Excel File
    with needed details before and
    result after 'You want'.
  4. Manuel998

    Manuel998 Member

    Messages:
    65
    requirement is in tab (colored green). Thanks for the help!

    Attached Files:

  5. vletm

    vletm Excel Ninja

    Messages:
    3,877
    Manuel998
    You added other 'want' too...
    How would handle if there is already same name 'Tab' or 'Workbook'?
  6. Manuel998

    Manuel998 Member

    Messages:
    65
    there would not be a same name worksheet because the drop down list in C3 will have unique names. hope this makes sense?
  7. Manuel998

    Manuel998 Member

    Messages:
    65
    this is cell C3 on the cash tab
  8. vletm

    vletm Excel Ninja

    Messages:
    3,877
    Manuel998
    Many users select two... three... more times same selection from dropdown.
    Then same 'unique'-name will use many times.
  9. Manuel998

    Manuel998 Member

    Messages:
    65
    I will be the only one accessing and the drop down.
  10. vletm

    vletm Excel Ninja

    Messages:
    3,877
    Manuel998
    So take care that the only You will accessing this ... only You!

    Attached Files:

  11. Manuel998

    Manuel998 Member

    Messages:
    65
    Thanks Vletm, but i cant see the code in the workbook?
  12. vletm

    vletm Excel Ninja

    Messages:
    3,877
    Manuel998
    Did You test it?
    If it works, then code is also there.
  13. Marc L

    Marc L Excel Ninja

    Messages:
    4,221


    Yes of course, I see your code …​
  14. vletm

    vletm Excel Ninja

    Messages:
    3,877
    If Marc L can find the code, then it's there
    ... but that file was only for Manuel998
    'I will be the only one accessing and the drop down' as Manuel998 wrote,
    because some challenges for others.
  15. Manuel998

    Manuel998 Member

    Messages:
    65
    I got nothing. does it matter if i am using excel 2010?

    upload_2018-8-14_9-1-38.png
  16. vletm

    vletm Excel Ninja

    Messages:
    3,877
    Manuel998
    No matter which Excel-version.
    1) It needs to go to correct code-page
    2) Select from [General] that other option
    3) Select from 'right'-selector 'Change'...

Share This Page