0 Replies Latest reply: May 21, 2012 9:59 AM by dohapark RSS

    Macro exporting on to multiple tabs in same workbook

      Hello!

       

       

      I have two excel macros and I was wondering if anyone knew how to combine them.  I already have my macro formating sheets the way I want it so if there was a simple way to combine them it would help me a great deal.  Also want to know how to delete the other sheets (Sheet1, Sheet2)  I tried to follow the qliktip 32 but I couldn't figure out how to change it for my macro. 

       

      http://www.qlikblog.at/971/qliktip-32-exporting-multiple-objects-single-excel-document/

       

      Any help would be great as I have been stuck on how to fix this for a while and can't seem to get anything that works...  Thank you in advance!

       

       

      my macro looks something like this:

       

      Sub LCR_Export()

           Dim LCR

           Set XLApp = CreateObject("Excel.Application")

          XLApp.Visible = false

          Set XLDoc = XLApp.Workbooks.Add

           

           XLDoc.Sheets.Add.Name= "LCR REPORT"

         

          LCR = "LCR REPORT"

       

               ActiveDocument.GetSheetObject("CH06").CopyTableToClipboard true

                    XLDoc.Sheets(LCR).Range("A" &  8).Select

                    XLDoc.Sheets(LCR).Paste

       

           set obj = ActiveDocument.GetSheetObject("TX07")               

                             obj.CopyTextToClipboard

                    XLDoc.Sheets(LCR).Range("I" &  6).Select

                    XLDoc.Sheets(LCR).Paste          

       

       

      ...

       

       

       

         XLApp.Visible = True

        

      End Sub

       

       

       

       

      Sub Legend()

           Dim LGD

           Set XLApp = CreateObject("Excel.Application")

          XLApp.Visible = false

          Set XLDoc = XLApp.Workbooks.Add

       

           XLDoc.Sheets.Add.Name= "LEGEND"

         

          LGD = "LEGEND" 

               

           set obj = ActiveDocument.GetSheetObject("TX25")               

                             obj.CopyTextToClipboard

                    XLDoc.Sheets(LGD).Range("A" &  4).Select

                    XLDoc.Sheets(LGD).Paste

       

      ....

       

       

            XLApp.Visible = True

        

      End Sub