![]() |
character representation of specific column
Dear all,
Is there a simple way in VBA to get the character representation of specific column? For example, activesheet.cells(1, 2) = row = 1, column = "B" I guess using chr(activesheet.cells(1, 2).column + 64) could do the job from "A" to "Z". How about "AA"...? Thanks in advance! |
character representation of specific column
================================================== =
' Jun 08, 2002 - Created - Thanks to Chip Pearson ' Jim Cone - San Francisco, USA ' Returns the address of the column from the provided column number. '================================================= == Function GetColumnLetters(ByVal ColumnNum As Long) As String On Error GoTo NoColumn Dim ColChars As String ColChars = Columns(ColumnNum).Address(False, False) GetColumnLetters = Left$(ColChars, 2 + CBool(ColumnNum < 27)) '2 + 0 or 2 + (-1) Exit Function NoColumn: Beep GetColumnLetters = vbNullString End Function '================================================= == "KS Wong" wrote in message ... Dear all, Is there a simple way in VBA to get the character representation of specific column? For example, activesheet.cells(1, 2) = row = 1, column = "B" I guess using chr(activesheet.cells(1, 2).column + 64) could do the job from "A" to "Z". How about "AA"...? Thanks in advance! |
character representation of specific column
Thanks a lot, Jim
"Jim Cone" wrote: ================================================== = ' Jun 08, 2002 - Created - Thanks to Chip Pearson ' Jim Cone - San Francisco, USA ' Returns the address of the column from the provided column number. '================================================= == Function GetColumnLetters(ByVal ColumnNum As Long) As String On Error GoTo NoColumn Dim ColChars As String ColChars = Columns(ColumnNum).Address(False, False) GetColumnLetters = Left$(ColChars, 2 + CBool(ColumnNum < 27)) '2 + 0 or 2 + (-1) Exit Function NoColumn: Beep GetColumnLetters = vbNullString End Function '================================================= == "KS Wong" wrote in message ... Dear all, Is there a simple way in VBA to get the character representation of specific column? For example, activesheet.cells(1, 2) = row = 1, column = "B" I guess using chr(activesheet.cells(1, 2).column + 64) could do the job from "A" to "Z". How about "AA"...? Thanks in advance! |
All times are GMT +1. The time now is 11:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com