Hale, Jim
Jim.Hale at FleetPride.com
Mon Mar 20 10:14:54 CST 2006
This code was posted by Stuart McLachlan on 2/1. Is this what you were looking for? Jim Hale functions to change column numbers to name and vice versa 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 -----Original Message----- From: John Colby [mailto:jwcolby at colbyconsulting.com] Sent: Wednesday, February 01, 2006 9:51 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Manipulating Excel Cells I'm baaaack. ;-) Here's the deal. I am working with a spreadsheet that has columns of systems and rows of documents. Therefore each cell represents a system-document. BTW, this was a "source" for me to build a pair of tables - tblSystem and tblDocument. I then added a field to tblDocument called SpreadsheetRow and a field to tblSystem called SpreadsheetColumn. We are tracking the receipt of these documents. The client now wants to see, back in his original spreadsheet, the "status" of a given system document using colors to express the status - white = not assigned, red = not received, yellow = partial receipt, green = received. So... I have to go "poke colors" out into the spreadsheet. I have discovered the "area" property which has a color attribute. What I need now is a translation from the column LETTERS to a column number since for some bizarre reason the columns have letter names but cells are referenced by column numbers. "Brain damaged children" as Bill Cosby would say. Does anyone have code for manipulating cells by cell(intRowNumbers, strColNames)? John W. Colby www.ColbyConsulting.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com *********************************************************************** The information transmitted is intended solely for the individual or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this email in error please contact the sender and delete the material from any computer. As a recipient of this email, you are responsible for screening its contents and the contents of any attachments for the presence of viruses. No liability is accepted for any damages caused by any virus transmitted by this email.