Excel table breakdown to separate sheets?











up vote
0
down vote

favorite












I have a big dataset that looks like this:
enter image description here



The number of cols for each State is the same (Revenue, cost, and margin). The data set has a lot of other State to the right, let's say AZ, CO, CA, etc (the real dataset has more than 100 cities)



Now what I want to do is to break these huge pivoted dataset into separate tables in separate sheets in the same workbook as the original dataset (201701 for this example). They look like these 3 tables with the black header:
enter image description here



The 3 cols (revenue, cost, and margin) are the same for each table, while there are more programs than shown.



I have more files like these, so there will be 201702.xlsm, 201703.xlsm, etc.



Anyone can help me with this problem? Here's the code that I built using macro (needless to say, it doesn't work the way I want it to be).



Sub BreakdownTables()
'
' BreakdownTables Macro
'

'
Range("B1:D7").Select
Sheets.Add After:=ActiveSheet
Sheets("Trial").Select

'I basically just copy-paste the tables to separate sheets
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
Sheets("Trial").Select
Range("E1:G7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
Sheets.Add After:=ActiveSheet
Sheets("Sheet3").Select
ActiveSheet.Paste
Sheets("Trial").Select
Range("H1:J7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
Sheets("Sheet4").Select
Application.CutCopyMode = False
Sheets("Sheet4").Move After:=Sheets(9)
Range("F19").Select
Sheets("Sheet2").Select

'Trying to automatically rename the sheets
Sheets("Sheet2").Name = "="
Range("E13").Select
Sheets("=A1").Select
End Sub


I am at my wits end here and will gratefully appreciate any help or suggestion.
Thanks so much!










share|improve this question


























    up vote
    0
    down vote

    favorite












    I have a big dataset that looks like this:
    enter image description here



    The number of cols for each State is the same (Revenue, cost, and margin). The data set has a lot of other State to the right, let's say AZ, CO, CA, etc (the real dataset has more than 100 cities)



    Now what I want to do is to break these huge pivoted dataset into separate tables in separate sheets in the same workbook as the original dataset (201701 for this example). They look like these 3 tables with the black header:
    enter image description here



    The 3 cols (revenue, cost, and margin) are the same for each table, while there are more programs than shown.



    I have more files like these, so there will be 201702.xlsm, 201703.xlsm, etc.



    Anyone can help me with this problem? Here's the code that I built using macro (needless to say, it doesn't work the way I want it to be).



    Sub BreakdownTables()
    '
    ' BreakdownTables Macro
    '

    '
    Range("B1:D7").Select
    Sheets.Add After:=ActiveSheet
    Sheets("Trial").Select

    'I basically just copy-paste the tables to separate sheets
    Selection.Copy
    Sheets("Sheet2").Select
    ActiveSheet.Paste
    Sheets("Trial").Select
    Range("E1:G7").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Sheet2").Select
    Sheets.Add After:=ActiveSheet
    Sheets("Sheet3").Select
    ActiveSheet.Paste
    Sheets("Trial").Select
    Range("H1:J7").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets.Add After:=ActiveSheet
    ActiveSheet.Paste
    Sheets("Sheet4").Select
    Application.CutCopyMode = False
    Sheets("Sheet4").Move After:=Sheets(9)
    Range("F19").Select
    Sheets("Sheet2").Select

    'Trying to automatically rename the sheets
    Sheets("Sheet2").Name = "="
    Range("E13").Select
    Sheets("=A1").Select
    End Sub


    I am at my wits end here and will gratefully appreciate any help or suggestion.
    Thanks so much!










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have a big dataset that looks like this:
      enter image description here



      The number of cols for each State is the same (Revenue, cost, and margin). The data set has a lot of other State to the right, let's say AZ, CO, CA, etc (the real dataset has more than 100 cities)



      Now what I want to do is to break these huge pivoted dataset into separate tables in separate sheets in the same workbook as the original dataset (201701 for this example). They look like these 3 tables with the black header:
      enter image description here



      The 3 cols (revenue, cost, and margin) are the same for each table, while there are more programs than shown.



      I have more files like these, so there will be 201702.xlsm, 201703.xlsm, etc.



      Anyone can help me with this problem? Here's the code that I built using macro (needless to say, it doesn't work the way I want it to be).



      Sub BreakdownTables()
      '
      ' BreakdownTables Macro
      '

      '
      Range("B1:D7").Select
      Sheets.Add After:=ActiveSheet
      Sheets("Trial").Select

      'I basically just copy-paste the tables to separate sheets
      Selection.Copy
      Sheets("Sheet2").Select
      ActiveSheet.Paste
      Sheets("Trial").Select
      Range("E1:G7").Select
      Application.CutCopyMode = False
      Selection.Copy
      Sheets("Sheet2").Select
      Sheets.Add After:=ActiveSheet
      Sheets("Sheet3").Select
      ActiveSheet.Paste
      Sheets("Trial").Select
      Range("H1:J7").Select
      Application.CutCopyMode = False
      Selection.Copy
      Sheets.Add After:=ActiveSheet
      ActiveSheet.Paste
      Sheets("Sheet4").Select
      Application.CutCopyMode = False
      Sheets("Sheet4").Move After:=Sheets(9)
      Range("F19").Select
      Sheets("Sheet2").Select

      'Trying to automatically rename the sheets
      Sheets("Sheet2").Name = "="
      Range("E13").Select
      Sheets("=A1").Select
      End Sub


      I am at my wits end here and will gratefully appreciate any help or suggestion.
      Thanks so much!










      share|improve this question













      I have a big dataset that looks like this:
      enter image description here



      The number of cols for each State is the same (Revenue, cost, and margin). The data set has a lot of other State to the right, let's say AZ, CO, CA, etc (the real dataset has more than 100 cities)



      Now what I want to do is to break these huge pivoted dataset into separate tables in separate sheets in the same workbook as the original dataset (201701 for this example). They look like these 3 tables with the black header:
      enter image description here



      The 3 cols (revenue, cost, and margin) are the same for each table, while there are more programs than shown.



      I have more files like these, so there will be 201702.xlsm, 201703.xlsm, etc.



      Anyone can help me with this problem? Here's the code that I built using macro (needless to say, it doesn't work the way I want it to be).



      Sub BreakdownTables()
      '
      ' BreakdownTables Macro
      '

      '
      Range("B1:D7").Select
      Sheets.Add After:=ActiveSheet
      Sheets("Trial").Select

      'I basically just copy-paste the tables to separate sheets
      Selection.Copy
      Sheets("Sheet2").Select
      ActiveSheet.Paste
      Sheets("Trial").Select
      Range("E1:G7").Select
      Application.CutCopyMode = False
      Selection.Copy
      Sheets("Sheet2").Select
      Sheets.Add After:=ActiveSheet
      Sheets("Sheet3").Select
      ActiveSheet.Paste
      Sheets("Trial").Select
      Range("H1:J7").Select
      Application.CutCopyMode = False
      Selection.Copy
      Sheets.Add After:=ActiveSheet
      ActiveSheet.Paste
      Sheets("Sheet4").Select
      Application.CutCopyMode = False
      Sheets("Sheet4").Move After:=Sheets(9)
      Range("F19").Select
      Sheets("Sheet2").Select

      'Trying to automatically rename the sheets
      Sheets("Sheet2").Name = "="
      Range("E13").Select
      Sheets("=A1").Select
      End Sub


      I am at my wits end here and will gratefully appreciate any help or suggestion.
      Thanks so much!







      excel vba excel-vba






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 20 hours ago









      user71812

      916




      916





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203225%2fexcel-table-breakdown-to-separate-sheets%23new-answer', 'question_page');
          }
          );

          Post as a guest





































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203225%2fexcel-table-breakdown-to-separate-sheets%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          Popular posts from this blog

          Schultheiß

          Liste der Kulturdenkmale in Wilsdruff

          Android Play Services Check