[AccessD] Manipulating Excel Cells

John Colby jwcolby at ColbyConsulting.com
Wed Feb 1 16:59:47 CST 2006


Yeeehaaaw!

I found what appears to be an equivalent function out on the web but it was
a full page of code.

Thanks,

John W. Colby
www.ColbyConsulting.com 


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Wednesday, February 01, 2006 5:49 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Manipulating Excel Cells

On 1 Feb 2006 at 13:41, John Colby wrote:
> 
> So what I was looking for (and found) was a syntax for using column 
> letters instead of the silly cell(31,29).  What column is 29?  What 
> "number" is column BA?

In case you need it in future:

Function ColNumToName(ColNum As Long) As String
   If ColNum < 27 Then
       ColNumToName = Chr$(ColNum + 64)
   Else
       ColNumToName = _
          Chr$(Int((ColNum - 1) \ 26) + 64) _
          + Chr$((ColNum - 1) Mod 26 + 65)
   End If
End Function

Function ColNameToNum(ColName As String) As Long If Len(ColName) = 1 Then
ColNameToNum = Asc(UCase$(ColName)) - 64 Else ColNameToNum = 26 *
(Asc(UCase$(Left$(ColName, 1))) _
     - 64) + Asc(UCase$(Right$(ColName, 1))) - 64 End If End Function
--
Stuart


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list