+ Reply to Thread
Results 1 to 7 of 7

duplicating sheets based on cell content

  1. #1
    Registered User
    Join Date
    01-30-2019
    Location
    sheffield, england
    MS-Off Ver
    Excel 365
    Posts
    24

    duplicating sheets based on cell content

    HI

    I currently use the below code to generate copies of sheets based on a list in sheet 1 - List. What I am wanting to do is populate a specific cell, say A1 on sheet 1 - List with the name of the sheet I want to copy ie P9 on the example below, how would I do this?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: duplicating sheets based on cell content

    If I'm understanding correctly, If the name of the sheet is always hardcoded as "P9" in the code, you could just add the following line in red:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: duplicating sheets based on cell content

    You can also make the sheet to copy a string value in the code so you don't have to update three lines but one:

    Please Login or Register  to view this content.

  4. #4
    Spammer
    Join Date
    10-23-2012
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003, Office 365
    Posts
    1,237

    Re: duplicating sheets based on cell content

    Just change "P9" to Range("A1").Value....
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-30-2019
    Location
    sheffield, england
    MS-Off Ver
    Excel 365
    Posts
    24

    Re: duplicating sheets based on cell content

    Hi no the sheet to copy (P9 in this instance) would not be hardcoded, it would change based on what is in cell A1 on sheet 1 - List

    eg is "1 List" A1 if P13 then that would be the sheet that needs copying
    Last edited by Peaky_Blinder; 04-19-2023 at 01:57 AM.

  6. #6
    Registered User
    Join Date
    01-30-2019
    Location
    sheffield, england
    MS-Off Ver
    Excel 365
    Posts
    24

    Re: duplicating sheets based on cell content

    Quote Originally Posted by Croweater View Post
    Just change "P9" to Range("A1").Value....
    Please Login or Register  to view this content.
    His this worked a treat, if I was to want to do the same with another sheet but but that in B1 could I add this to the same code or would i need to add another?

  7. #7
    Registered User
    Join Date
    01-30-2019
    Location
    sheffield, england
    MS-Off Ver
    Excel 365
    Posts
    24

    Re: duplicating sheets based on cell content

    Im sorted guys now, thanks for your help

+ 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. Duplicating data on other sheets based on criteria
    By Gazsim in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-05-2020, 06:50 AM
  2. Populate rows on sheets based on a cell content
    By kc8jpk03 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-05-2016, 11:55 AM
  3. Automatically copy cells content based on the content of another cell.
    By chrisbarlow1984 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-01-2014, 11:13 AM
  4. [SOLVED] Duplicating only the formatting of a row not content
    By Frantelle in forum Excel General
    Replies: 11
    Last Post: 11-11-2012, 07:42 AM
  5. copying cell content into a specific workbook based on the content in that cell
    By krishna reddy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2012, 03:52 AM
  6. conditional transfer of rows to other sheets based on cell content of 2 colums
    By ashncg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2011, 12:22 PM
  7. Replies: 2
    Last Post: 12-19-2006, 10:50 PM

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