<?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 Macro - find last column in Excel file in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699684#M1067443</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;I have a macro in which I find the last Row with data in an excel file like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LR = XLSheet1.Range("A65535").End(-4162).Row &lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then later reference it successfully like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;XLSheet1.Range("G" &amp;amp; LR).Font.Size = 16&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am now trying to replace the Column (G) with similiar logic, to use the last column with data in, but the below is not working ("Unknown Runtime Error")"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LR= XLSheet1.Range("A65535").End(-4162).Row&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Find the last Row&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LC= XLSheet1.Range("A1").End(-4161).Column&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Find the last Column&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;XLSheet1.Range(LC &amp;amp; LR).Font.Size = 16&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help with the correct way of doing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gerhard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Sep 2014 13:18:31 GMT</pubDate>
    <dc:creator>gerhardl</dc:creator>
    <dc:date>2014-09-15T13:18:31Z</dc:date>
    <item>
      <title>Macro - find last column in Excel file</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699684#M1067443</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;I have a macro in which I find the last Row with data in an excel file like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LR = XLSheet1.Range("A65535").End(-4162).Row &lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then later reference it successfully like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;XLSheet1.Range("G" &amp;amp; LR).Font.Size = 16&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am now trying to replace the Column (G) with similiar logic, to use the last column with data in, but the below is not working ("Unknown Runtime Error")"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LR= XLSheet1.Range("A65535").End(-4162).Row&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Find the last Row&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LC= XLSheet1.Range("A1").End(-4161).Column&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Find the last Column&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;XLSheet1.Range(LC &amp;amp; LR).Font.Size = 16&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help with the correct way of doing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gerhard&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 13:18:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699684#M1067443</guid>
      <dc:creator>gerhardl</dc:creator>
      <dc:date>2014-09-15T13:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - find last column in Excel file</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699685#M1067444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try -4159 instead of -4161 for xltoleft&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Sep 2014 16:58:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699685#M1067444</guid>
      <dc:creator>m_woolf</dc:creator>
      <dc:date>2014-09-15T16:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Macro - find last column in Excel file</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699686#M1067445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That doesn't work either - please see image attached. The issue seems to be at the point where I try and reference the cell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it not that the ".End(-4159).Column" returns a column NUMBER, and I am trying to use it as a column NAME (e.g. "G")?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Image.jpg" class="jive-image" src="https://community.qlik.com/legacyfs/online/66847_Image.jpg" style="width: 620px; height: 325px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 05:41:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699686#M1067445</guid>
      <dc:creator>gerhardl</dc:creator>
      <dc:date>2014-09-16T05:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro - find last column in Excel file</title>
      <link>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699687#M1067446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use some kind of mapping directly in qv or in vbs or you used a function which converted a number to a string. I use since many years these:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function Spalte1(Optional SpaltenBuchstabe As Variant) As Variant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Dim varArr As Variant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; If IsMissing(SpaltenBuchstabe) Then _&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpaltenBuchstabe = Range(Application.Caller.Address(0, 0)).Column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; If SpaltenBuchstabe &amp;lt; 1 Or SpaltenBuchstabe &amp;gt; 256 Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Spalte1 = CVErr(xlErrValue)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; varArr = Split(Columns(SpaltenBuchstabe).Address(0, 0), ":") ' liefert für Spalte 1 ="A:A"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Spalte1 = varArr(0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you will find many more examples here: &lt;A href="https://www.google.de/?gws_rd=ssl#q=vba+function+spaltenbuchstabe" title="https://www.google.de/?gws_rd=ssl#q=vba+function+spaltenbuchstabe"&gt;Google&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Sep 2014 06:46:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Macro-find-last-column-in-Excel-file/m-p/699687#M1067446</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2014-09-16T06:46:53Z</dc:date>
    </item>
  </channel>
</rss>

