View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Raman325[_25_] Raman325[_25_] is offline
external usenet poster
 
Posts: 1
Default Linking two cells


After searching Google for a while, I finally found the followin
snippet of code at http://www.freevbcode.com/ShowCode.asp?ID=4303


Code
-------------------
Function ColumnLetter(ColumnNumber As Integer) As String
If ColumnNumber 26 Then

' 1st character: Subtract 1 to map the characters to 0-25,
' but you don't have to remap back to 1-26
' after the 'Int' operation since columns
' 1-26 have no prefix letter

' 2nd character: Subtract 1 to map the characters to 0-25,
' but then must remap back to 1-26 after
' the 'Mod' operation by adding 1 back in
' (included in the '65')

ColumnLetter = Chr(Int((ColumnNumber - 1) / 26) + 64) & _
Chr(((ColumnNumber - 1) Mod 26) + 65)
Else
' Columns A-Z
ColumnLetter = Chr(ColumnNumber + 64)
End If
End Functio
-------------------


This code allows me to get the column letter based on the column numbe
so I can use the Column and Row property of wagNDCell to determine th
cell name. Thanks agian for your help

--
Raman32
-----------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...fo&userid=2474
View this thread: http://www.excelforum.com/showthread.php?threadid=39651