<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sorting excel export through Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050931#M352794</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's a recent example to append data to already existing data in excel a with vbs-macro which might be itself useful in your case - but more important is to look on the right syntax. This meant you need to add always the created objects to the statements (in opposite to vba in excel) and you couldn't use excel-constants (I think it would be possible to activbate the appropriate libraries but this makes the things more complex) else you need to use the numeric equivalents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub AppendDataToExcelFile&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dim doc, ex, xlApp, xlDoc, xlSheet, LastRow&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Const xlUp = -4162&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set doc = ActiveDocument&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set xlApp = CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;Set xlDoc = &lt;STRONG&gt;xlapp&lt;/STRONG&gt;.Workbooks.Open("D:\YourPath\YourFile.xls")&lt;/P&gt;&lt;P&gt;xlapp.Visible = true&lt;/P&gt;&lt;P&gt;Set xlSheet = &lt;STRONG&gt;xlDoc&lt;/STRONG&gt;.Worksheets("YourSheet")&lt;/P&gt;&lt;P&gt;xlSheet.Activate&lt;/P&gt;&lt;P&gt;LastRow = &lt;STRONG&gt;xlSheet&lt;/STRONG&gt;.Cells(&lt;STRONG&gt;xlSheet&lt;/STRONG&gt;.Rows.Count, 1).End(&lt;STRONG&gt;xlUp&lt;/STRONG&gt;).Row&lt;/P&gt;&lt;P&gt;msgbox LastRow&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;xlSheet&lt;/STRONG&gt;.Cells(LastRow + 1, 1).Select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'doc.fields("Jahr").clear 'optional to set or clear selections&lt;/P&gt;&lt;P&gt;'doc.GetApplication.WaitForIdle&lt;/P&gt;&lt;P&gt;doc.GetSheetObject("CH10021").CopyTableToClipboard true&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xlSheet.Paste&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xlDoc.Save&lt;/P&gt;&lt;P&gt;xlDoc.Close&lt;/P&gt;&lt;P&gt;xlApp.Quit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Feb 2016 15:19:45 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2016-02-17T15:19:45Z</dc:date>
    <item>
      <title>Sorting excel export through Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050926#M352789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have a macro that exports two straight tables and concatenates them in the excel. I need to sort this data based on a column. Can someone help me with the syntax (as in QlikView macro) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following is the script example that I have tried, but it doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sheet.Range("A:Z").Sort Key1 = Sheet.Range("E2"), Order1 =2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have data in column A through Z, I need to sort the data in descending order with values in column E.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 08:26:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050926#M352789</guid>
      <dc:creator>reshmakala</dc:creator>
      <dc:date>2016-02-17T08:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting excel export through Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050927#M352790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Try,&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Sheet.Range("A:Z").Sort Key1 &lt;STRONG style="color: #ff0000;"&gt;:=&lt;/STRONG&gt; Sheet.Range("E2"), Order1 &lt;STRONG&gt;&lt;SPAN style="color: #ff0000;"&gt;:=&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;xlDescending&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 08:35:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050927#M352790</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2016-02-17T08:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting excel export through Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050928#M352791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this link for sample piece of code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.teachexcel.com/excel-help/excel-how-to.php?i=495139" title="http://www.teachexcel.com/excel-help/excel-how-to.php?i=495139"&gt;Excel - Sort Multiple Sheets - Help - I have a workbook... - Free Excel Help&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of = give :=&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Sheet.Range("A:Z").Sort Key1 := Sheet.Range("E2"), Order1 :=2&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 08:46:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050928#M352791</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2016-02-17T08:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting excel export through Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050929#M352792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nagraj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;:= gives me a "Macro Parse Failed" error in QlikView. It works in Excel thought. I also tried xlDescending but that doesn't work either.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 15:00:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050929#M352792</guid>
      <dc:creator>reshmakala</dc:creator>
      <dc:date>2016-02-17T15:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting excel export through Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050930#M352793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jagan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried := it works in excel, but doesn't work in QlikView, give me a &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;"Macro Parse Failed" error.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 15:02:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050930#M352793</guid>
      <dc:creator>reshmakala</dc:creator>
      <dc:date>2016-02-17T15:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting excel export through Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050931#M352794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's a recent example to append data to already existing data in excel a with vbs-macro which might be itself useful in your case - but more important is to look on the right syntax. This meant you need to add always the created objects to the statements (in opposite to vba in excel) and you couldn't use excel-constants (I think it would be possible to activbate the appropriate libraries but this makes the things more complex) else you need to use the numeric equivalents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sub AppendDataToExcelFile&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dim doc, ex, xlApp, xlDoc, xlSheet, LastRow&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Const xlUp = -4162&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;set doc = ActiveDocument&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set xlApp = CreateObject("Excel.Application")&lt;/P&gt;&lt;P&gt;Set xlDoc = &lt;STRONG&gt;xlapp&lt;/STRONG&gt;.Workbooks.Open("D:\YourPath\YourFile.xls")&lt;/P&gt;&lt;P&gt;xlapp.Visible = true&lt;/P&gt;&lt;P&gt;Set xlSheet = &lt;STRONG&gt;xlDoc&lt;/STRONG&gt;.Worksheets("YourSheet")&lt;/P&gt;&lt;P&gt;xlSheet.Activate&lt;/P&gt;&lt;P&gt;LastRow = &lt;STRONG&gt;xlSheet&lt;/STRONG&gt;.Cells(&lt;STRONG&gt;xlSheet&lt;/STRONG&gt;.Rows.Count, 1).End(&lt;STRONG&gt;xlUp&lt;/STRONG&gt;).Row&lt;/P&gt;&lt;P&gt;msgbox LastRow&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;xlSheet&lt;/STRONG&gt;.Cells(LastRow + 1, 1).Select&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'doc.fields("Jahr").clear 'optional to set or clear selections&lt;/P&gt;&lt;P&gt;'doc.GetApplication.WaitForIdle&lt;/P&gt;&lt;P&gt;doc.GetSheetObject("CH10021").CopyTableToClipboard true&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xlSheet.Paste&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xlDoc.Save&lt;/P&gt;&lt;P&gt;xlDoc.Close&lt;/P&gt;&lt;P&gt;xlApp.Quit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Feb 2016 15:19:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sorting-excel-export-through-Macro/m-p/1050931#M352794</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-02-17T15:19:45Z</dc:date>
    </item>
  </channel>
</rss>

