<?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 Format Excel during Export Macro in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219599#M72610</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you use a different letter for each loop? If you use i for the first, then use j for the second. Nested loops seem to work, but require different letters to prevent the parse error.&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;For i = 1 to 2&lt;BR /&gt; For j = 1 to 3&lt;BR /&gt; MsgBox(i &amp;amp; j)&lt;BR /&gt; Next&lt;BR /&gt;Next&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;should work. &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Dec 2010 22:48:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-12-09T22:48:42Z</dc:date>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219592#M72603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After several hours I've given up and beg for help from the QV community. My users are asking that after a pivot chart has been exported to Excel blank rows should be inserted betweeen each row of data so that they are able to write comments concerning the data in the row above. I've mashed together some code I found until I am able to export the chart to Excel, but I can't seem to get the row insertion part to work. I keep getting an error whenever I try to refer to the ActiveCell. Here's a portion of the relevant code I've got so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XLDoc.Worksheets.Add&lt;/P&gt;&lt;P&gt;XLDoc.Worksheets("Sheet"&amp;amp;m).activate&lt;/P&gt;&lt;P&gt;XLDoc.Worksheets("Sheet"&amp;amp;m).Name = vTitle&lt;/P&gt;&lt;P&gt;set vObj = ActiveDocument.GetSheetObject(vCurrentPivot)&lt;/P&gt;&lt;P&gt;vObj.CopyTableToClipboard true&lt;/P&gt;&lt;P&gt;XLDoc.WorkSheets(vTitle).Paste XLDoc.Sheets(vTitle).Range("A1")&lt;/P&gt;&lt;P&gt;XLDoc.WorkSheets(vTitle).Cells.select&lt;/P&gt;&lt;P&gt;XLDoc.WorkSheets(vTitle).Cells.mergecells = false&lt;/P&gt;&lt;P&gt;XLDoc.WorkSheets(vTitle).Cells.EntireRow.RowHeight = 12.75&lt;/P&gt;&lt;P&gt;XLDoc.WorkSheets(vTitle).Cells.EntireColumn.AutoFit&lt;/P&gt;&lt;P&gt;XLDoc.WorkSheets(vTitle).Cells.NumberFormat = "0"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xlDown=-4121&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XLDoc.WorkSheets(vTitle).Range("A1").select&lt;/P&gt;&lt;P&gt;With XLDoc.WorkSheets(vTitle).Range("A1")&lt;/P&gt;&lt;P&gt;.End(xlDown).select&lt;/P&gt;&lt;P&gt;End With&lt;/P&gt;&lt;P&gt;'msgbox XLDoc.WorkSheets(vTitle).ActiveCell.Value&lt;/P&gt;&lt;P&gt;Do While XLDoc.WorkSheets(vTitle).ActiveCell.Row &amp;gt; 2&lt;/P&gt;&lt;P&gt;'Insert blank row.&lt;/P&gt;&lt;P&gt;'XLDoc.WorkSheets(vTitle).EntireRow.Insert shift:=xlDown&lt;/P&gt;&lt;P&gt;'Move up one row.&lt;/P&gt;&lt;P&gt;XLDoc.WorkSheets(vTitle).ActiveCell.Offset(-1, 0).activate&lt;/P&gt;&lt;P&gt;Loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 21:08:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219592#M72603</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-09T21:08:45Z</dc:date>
    </item>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219593#M72604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to reference a Range to insert a row. QlikView automation cannot use the Select/Selection code.&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;XLDoc.WorkSheets(vTitle).Range("A2").EntireRow.Insert&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Also, you can't use the shift:=xlDown format. I think you can make Insert a function and then use the value of the xlDown constant (-4121).&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;XLDoc.WorkSheets(vTitle).Range("A2").EntireRow.Insert(-4121)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;In order to do it in a loop, I would first determine the last used row. I used to use Range("A65536") and then do an xlUp. Then store the Row in a variable. I'm not sure if that all works in QlikView automation though. Then you could use a For Next.&lt;/P&gt;&lt;P&gt;You may also be able to use QlikView to determine the number of rows and then put that in your For Next. Or you could just use a sufficient number, because if you insert rows after all of your data, they all just look like blank rows.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 21:21:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219593#M72604</guid>
      <dc:creator />
      <dc:date>2010-12-09T21:21:54Z</dc:date>
    </item>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219594#M72605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That works for inserting a static row, thanks. But my code needs to insert a row in between each data row exported. The method I was trying to use was after pasting in the data, move to the last data row then, using a loop, insert a blank row between the data rows.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 21:30:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219594#M72605</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-09T21:30:43Z</dc:date>
    </item>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219595#M72606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you need to put it into a For Next loop and then use:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;XLDoc.WorkSheets(vTitle).Range("A" &amp;amp; i).EntireRow.Insert(-4121)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Try:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;For i = 50 To 2 Step -1&lt;BR /&gt; XLDoc.WorkSheets(vTitle).Range("A" &amp;amp; i).EntireRow.Insert(-4121)&lt;BR /&gt;Next&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;You could probably reduce that 65536 to a lower number based on how many records you have. That should work, but it may be slower.&lt;/P&gt;&lt;P&gt;You can't use the code to move up rows, because QlikView automation does not allow for the Select/Selection stuff. QlikView won't hold a place, so you have to reference cells using Range.&lt;/P&gt;&lt;P&gt;EDIT: Start small on the loop. I'm sitting here waiting for it to run down from 65536. &lt;IMG alt="Big Smile" src="http://community.qlik.com/emoticons/emotion-2.gif" /&gt;&lt;/P&gt;&lt;P&gt;It worked fine looping from 65536 to 2, but it took about a minute. If you can reduce that to a lower number (even like 2000 or something), you should get better results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 21:38:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219595#M72606</guid>
      <dc:creator />
      <dc:date>2010-12-09T21:38:47Z</dc:date>
    </item>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219596#M72607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get a Macro Parse Failed error with that For...Next code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 21:58:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219596#M72607</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-09T21:58:13Z</dc:date>
    </item>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219597#M72608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is taken directly from the macro I tested it on, so the references are a little different:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;For i = 65536 To 2 Step -1&lt;BR /&gt; oSH.Range("A" &amp;amp; i).EntireRow.Insert(-4121)&lt;BR /&gt;Next&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I added this one (your references) without error:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;For i = 9 To 1 Step -1&lt;BR /&gt; XLDoc.WorkSheets(vTitle).Range("A" &amp;amp; i).EntireRow.Insert(-4121)&lt;BR /&gt;Next&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 22:15:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219597#M72608</guid>
      <dc:creator />
      <dc:date>2010-12-09T22:15:58Z</dc:date>
    </item>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219598#M72609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it's because I'm trying to put a For...Next loop within a For...Next loop (I'm exporting multiple charts to to different worksheets).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 22:22:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219598#M72609</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-09T22:22:25Z</dc:date>
    </item>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219599#M72610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you use a different letter for each loop? If you use i for the first, then use j for the second. Nested loops seem to work, but require different letters to prevent the parse error.&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;For i = 1 to 2&lt;BR /&gt; For j = 1 to 3&lt;BR /&gt; MsgBox(i &amp;amp; j)&lt;BR /&gt; Next&lt;BR /&gt;Next&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;should work. &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 22:48:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219599#M72610</guid>
      <dc:creator />
      <dc:date>2010-12-09T22:48:42Z</dc:date>
    </item>
    <item>
      <title>Format Excel during Export Macro</title>
      <link>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219600#M72611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That did it! Thanks so much for your help!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 22:54:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Format-Excel-during-Export-Macro/m-p/219600#M72611</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-12-09T22:54:02Z</dc:date>
    </item>
  </channel>
</rss>

