<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: VBA Routine to return Column Letter of Cell</title>
	<atom:link href="http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/</link>
	<description>Everything Excel. Only Excel.</description>
	<lastBuildDate>Mon, 21 Nov 2011 07:25:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: EasySolution</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-2128</link>
		<dc:creator>EasySolution</dc:creator>
		<pubDate>Mon, 04 Jul 2011 15:22:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-2128</guid>
		<description>A simple function for all cases:
——————————–

Function getColNameFromIndex(ByVal colIndex As Integer) As String

getColNameFromIndex = “”

getColNameFromIndex = Left(Cells(1, colIndex).Address(1, 0), InStr(1, Cells(1, colIndex).Address(1, 0), “$”) – 1)

End Function</description>
		<content:encoded><![CDATA[<p>A simple function for all cases:<br />
——————————–</p>
<p>Function getColNameFromIndex(ByVal colIndex As Integer) As String</p>
<p>getColNameFromIndex = “”</p>
<p>getColNameFromIndex = Left(Cells(1, colIndex).Address(1, 0), InStr(1, Cells(1, colIndex).Address(1, 0), “$”) – 1)</p>
<p>End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EasySolution</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-2127</link>
		<dc:creator>EasySolution</dc:creator>
		<pubDate>Mon, 04 Jul 2011 15:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-2127</guid>
		<description>A simple function for all cases:
--------------------------------

Function getColNameFromIndex(ByVal colIndex As Integer) As String

    getColNameFromIndex = &quot;&quot;

    If (colIndex = 16385) Then
        Exit Function
    End If

    getColNameFromIndex = Left(Cells(1, colIndex).Address(1, 0), InStr(1, Cells(1, colIndex).Address(1, 0), &quot;$&quot;) - 1)

End Function</description>
		<content:encoded><![CDATA[<p>A simple function for all cases:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Function getColNameFromIndex(ByVal colIndex As Integer) As String</p>
<p>    getColNameFromIndex = &#8220;&#8221;</p>
<p>    If (colIndex = 16385) Then<br />
        Exit Function<br />
    End If</p>
<p>    getColNameFromIndex = Left(Cells(1, colIndex).Address(1, 0), InStr(1, Cells(1, colIndex).Address(1, 0), &#8220;$&#8221;) &#8211; 1)</p>
<p>End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shafer</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-2048</link>
		<dc:creator>Shafer</dc:creator>
		<pubDate>Wed, 06 Apr 2011 14:29:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-2048</guid>
		<description>This one works.

Function Alpha_Column(Cell_Add As Range) As String
Dim No_of_Rows As Integer
Dim No_of_Cols As Integer
Dim Num_Column As Integer
Dim firstColumnLetter As String
Dim secondColumnLetter As String

No_of_Rows = Cell_Add.Rows.Count
No_of_Cols = Cell_Add.Columns.Count

If ((No_of_Rows  1) Or (No_of_Cols  1)) Then
    Alpha_Column = &quot;&quot;
    Exit Function
End If
 Num_Column = Cell_Add.Column
If Num_Column &lt; 26 Then
    Alpha_Column = Chr(64 + Num_Column)
Else
    If Num_Column Mod 26  0 Then
        firstColumnLetter = Chr(Int(Num_Column / 26) + 64)
        secondColumnLetter = Chr((Num_Column Mod 26) + 64)
    Else
        firstColumnLetter = Chr(Int(Num_Column / 26) + 63)
        secondColumnLetter = &quot;Z&quot;
    End If
    
    Alpha_Column = firstColumnLetter &amp; secondColumnLetter
End If
End Function</description>
		<content:encoded><![CDATA[<p>This one works.</p>
<p>Function Alpha_Column(Cell_Add As Range) As String<br />
Dim No_of_Rows As Integer<br />
Dim No_of_Cols As Integer<br />
Dim Num_Column As Integer<br />
Dim firstColumnLetter As String<br />
Dim secondColumnLetter As String</p>
<p>No_of_Rows = Cell_Add.Rows.Count<br />
No_of_Cols = Cell_Add.Columns.Count</p>
<p>If ((No_of_Rows  1) Or (No_of_Cols  1)) Then<br />
    Alpha_Column = &#8220;&#8221;<br />
    Exit Function<br />
End If<br />
 Num_Column = Cell_Add.Column<br />
If Num_Column &lt; 26 Then<br />
    Alpha_Column = Chr(64 + Num_Column)<br />
Else<br />
    If Num_Column Mod 26  0 Then<br />
        firstColumnLetter = Chr(Int(Num_Column / 26) + 64)<br />
        secondColumnLetter = Chr((Num_Column Mod 26) + 64)<br />
    Else<br />
        firstColumnLetter = Chr(Int(Num_Column / 26) + 63)<br />
        secondColumnLetter = &#8220;Z&#8221;<br />
    End If</p>
<p>    Alpha_Column = firstColumnLetter &amp; secondColumnLetter<br />
End If<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kedar Kulkarni</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-1730</link>
		<dc:creator>Kedar Kulkarni</dc:creator>
		<pubDate>Tue, 19 Oct 2010 15:38:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-1730</guid>
		<description>Same as Andy, just 1 char even less and just 3 functions and may be the shortest;)
=SUBSTITUTE(ADDRESS(1,COLUMN(),4),&quot;1&quot;,&quot;&quot;)</description>
		<content:encoded><![CDATA[<p>Same as Andy, just 1 char even less and just 3 functions and may be the shortest;)<br />
=SUBSTITUTE(ADDRESS(1,COLUMN(),4),&#8221;1&#8243;,&#8221;")</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-1720</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Sat, 09 Oct 2010 17:47:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-1720</guid>
		<description>@Kiran,

Four characters shorter, but more importantly, two function calls less...

=LEFT(ADDRESS(ROW(),COLUMN(),2),FIND(&quot;$&quot;,ADDRESS(ROW(),COLUMN(),2))-1)</description>
		<content:encoded><![CDATA[<p>@Kiran,</p>
<p>Four characters shorter, but more importantly, two function calls less&#8230;</p>
<p>=LEFT(ADDRESS(ROW(),COLUMN(),2),FIND(&#8220;$&#8221;,ADDRESS(ROW(),COLUMN(),2))-1)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oo WARLOCK oO</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-1675</link>
		<dc:creator>Oo WARLOCK oO</dc:creator>
		<pubDate>Thu, 02 Sep 2010 18:16:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-1675</guid>
		<description>Hi all,

Just wanted to point out one major flaw with the original post.  If the Num_Column is equal to 26 then the remainder will be 0.  The value falls in the else condition where the first part of Alpha_Column formula &quot;Chr(Int(Num_Column / 26) + 64)&quot; is 65 which is equal to the ASCII Chr of A.  In second part of the Alpha_Column formula &quot;Chr((Num_Column Mod 26) + 64)&quot; is the remainder, 0, plus 64, which is 64.  The ASCII value for 64 is &quot;@&quot;.  Alpha_Column is then equal to &quot;A@&quot; which is definitely wrong.  So to correct this simply modify the operator in the statement, &quot;If Num_Column &lt; 26 Then&quot; to &quot;If Num_Column &lt;= 26 Then&quot;.</description>
		<content:encoded><![CDATA[<p>Hi all,</p>
<p>Just wanted to point out one major flaw with the original post.  If the Num_Column is equal to 26 then the remainder will be 0.  The value falls in the else condition where the first part of Alpha_Column formula &#8220;Chr(Int(Num_Column / 26) + 64)&#8221; is 65 which is equal to the ASCII Chr of A.  In second part of the Alpha_Column formula &#8220;Chr((Num_Column Mod 26) + 64)&#8221; is the remainder, 0, plus 64, which is 64.  The ASCII value for 64 is &#8220;@&#8221;.  Alpha_Column is then equal to &#8220;A@&#8221; which is definitely wrong.  So to correct this simply modify the operator in the statement, &#8220;If Num_Column &lt; 26 Then&quot; to &quot;If Num_Column &lt;= 26 Then&quot;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kiran</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-1498</link>
		<dc:creator>Kiran</dc:creator>
		<pubDate>Wed, 14 Apr 2010 13:59:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-1498</guid>
		<description>Kev, your solution is perfect
=LEFT(ADDRESS(ROW(),COLUMN(),4),LEN(ADDRESS(ROW(),COLUMN(),4))-LEN(ROW()))

returns column name correctly</description>
		<content:encoded><![CDATA[<p>Kev, your solution is perfect<br />
=LEFT(ADDRESS(ROW(),COLUMN(),4),LEN(ADDRESS(ROW(),COLUMN(),4))-LEN(ROW()))</p>
<p>returns column name correctly</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve King</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-1493</link>
		<dc:creator>Steve King</dc:creator>
		<pubDate>Fri, 09 Apr 2010 20:22:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-1493</guid>
		<description>Why not just use the following:

[range object].column

where [range object] can be Selection, ActiveCell, or any variable declared as Range.  Then use Cells(x, y) for whatever you need.

It&#039;s easier for loops to use numbers than letters.  (That&#039;s meant to invoke a smile or two from those who get it.)</description>
		<content:encoded><![CDATA[<p>Why not just use the following:</p>
<p>[range object].column</p>
<p>where [range object] can be Selection, ActiveCell, or any variable declared as Range.  Then use Cells(x, y) for whatever you need.</p>
<p>It&#8217;s easier for loops to use numbers than letters.  (That&#8217;s meant to invoke a smile or two from those who get it.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-1387</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Sat, 26 Dec 2009 21:29:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-1387</guid>
		<description>@Andyman

Two points... First, you don&#039;t really need the row to be specified as you can use hard code any row number into the Cells property call (I would suggest using 1) since the column letter is not dependent on the row number. Second, you code will return the wrong answer if the column number is greater than 26.</description>
		<content:encoded><![CDATA[<p>@Andyman</p>
<p>Two points&#8230; First, you don&#8217;t really need the row to be specified as you can use hard code any row number into the Cells property call (I would suggest using 1) since the column letter is not dependent on the row number. Second, you code will return the wrong answer if the column number is greater than 26.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andyman</title>
		<link>http://www.automateexcel.com/2008/11/04/vba-routine-to-return-column-letter-of-cell/comment-page-1/#comment-1384</link>
		<dc:creator>Andyman</dc:creator>
		<pubDate>Sat, 19 Dec 2009 12:17:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=1115#comment-1384</guid>
		<description>Came up with this not too long ago:

Sub GetColumn(ByVal row As Integer, ByVal col As Integer, ByRef letter As String)
    addr = Sheet1.Cells(row, col).Address(False, False)
    letter = Left(addr, 1)
End Sub

Called like this:

Call GetColumn(r, c, colLetter)

Doing that stores the column letter in the variable colLetter.  Integers can be input for r and c to indicate which cell you are talking about.</description>
		<content:encoded><![CDATA[<p>Came up with this not too long ago:</p>
<p>Sub GetColumn(ByVal row As Integer, ByVal col As Integer, ByRef letter As String)<br />
    addr = Sheet1.Cells(row, col).Address(False, False)<br />
    letter = Left(addr, 1)<br />
End Sub</p>
<p>Called like this:</p>
<p>Call GetColumn(r, c, colLetter)</p>
<p>Doing that stores the column letter in the variable colLetter.  Integers can be input for r and c to indicate which cell you are talking about.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

