+ Reply to Thread
Results 1 to 2 of 2

Mapping data from various row data from columns to variable cells and sheet names

  1. #1
    Registered User
    Join Date
    07-03-2023
    Location
    Australia
    MS-Off Ver
    2020
    Posts
    1

    Mapping data from various row data from columns to variable cells and sheet names

    0


    I have a macro that is creating sets of workbooks from multiple different sheets. For each row within my worksheet table a new workbook is created with certain sheets added to each new workbook depending on a key word in one of the columns on the same row.

    I am trying to create a way to map the other row data in a table to certain cells and sheet?s depending on the key. And also create a way to make the sets of sheets variable and key?s variable.

    I can do this with my current code however it?s fixed in code

    I want this functionality to be variable through a user form , or even through a mapping table of sorts on my main worksheet. Rather than changing the code each time the sheet names change

    As I mentioned I currently can carry out this functionality yet I want my employees to be able to determine where their data sets go and how the sheets are grouped.

    The other part is I can?t have references to worksheets as the files are emailed and passed throughout the different areas of the business ***** edit**** The drop downs are determines by a FSO, basically only allowing the user to select from a standard set of templates in a specific folder.

    Below is a sample of the variable data I wish to map left column is the Key for the sheet set /TYPE.Data to be mapped image 1

    Below is the Proposed layout for the grouping of the sets/TYPE, this determines what sheets are to be added into each set or type. Set Grouping image 2

    The output documents are variable however generally look lilke the following, and required to be in any of the cells that the users wishes. output data example

    The following is a snippet of the current code that is being used

    If worksheetSet = "CB" Then
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXXX)").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ElseIf worksheetSet = "DH" Then
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)
    ThisWorkbook.Sheets("XXXX").Copy After:=targetWb.Sheets(targetWb.Sheets.Count)

    Populate relevant cells in each sheet
    For Each sht In targetWb.Sheets
    sht.Range("C1:C2").Value = ThisWorkbook.Sheets(1).Range("AI14:AI15").Value
    sht.Range("L2").Value = ThisWorkbook.Sheets(1).Range("AI16").Value
    sht.Range("L3").Value = wsCxList.Cells(i, "B").Value
    sht.Range("C3").Value = wsCxList.Cells(i, "D").Value56C79D74-DD77-4A88-98DA-D4168321A54B.jpeg3E09D5B5-31A6-4211-927B-628924A77CA5.jpeg
    Attached Images Attached Images

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Mapping data from various row data from columns to variable cells and sheet names


    Just use worksheets codenames rather than worksheets names as a codename does not change when a worksheet is renamed …

+ 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] split data from sheet to three sheets for many names based on two columns
    By leap out in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-14-2021, 10:02 AM
  2. Replies: 1
    Last Post: 05-24-2018, 09:45 AM
  3. [SOLVED] Help using Names Ranges to sum data in rows across variable numbers of columns
    By azzurri825 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-15-2013, 05:15 AM
  4. Data mapping one sheet to another
    By ramserp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-04-2010, 08:30 AM
  5. [SOLVED] Using Excel's XML mapping/export with data organized in columns
    By DaveWhatmuff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  6. [SOLVED] Using Excel's XML mapping/export with data organized in columns
    By DaveWhatmuff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. Using Excel's XML mapping/export with data organized in columns
    By DaveWhatmuff in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-16-2005, 02:05 PM

Tags for this Thread

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