Someone must know this?
Basically, how do I convert "11" to "K"??
I ned to convert a column letter to a column number for the following line of code in my VBA application:
I am inserting a formula into a cell using VBA, but the problem is that I don't know the letter value of column "K" (used in teh middle of the line); instead, I know it as column number 11. Is there a simple way to convert the column number 11 to the column letter "K"?Code:strAverageBaseFormula = "=AVERAGE(D" & Trim(Str(lngFirstRowOfIncrement + 1)) & ":K" & Trim(Str(lngFirstRowOfIncrement + 1)) & ")"
Last edited by bdonkersgoed; November 22nd, 2005 at 01:14.
One way,[vba]=AVERAGE(D" & Trim(Str(lngFirstRowOfIncrement + 1)) & ":" & _
Left(Cells(1, 11).Address(False, False), Len(Cells(1, 11).Address(False, False)) - 1) & Trim(Str(lngFirstRowOfIncrement + 1)) & ")" [/vba]
Hmmmm . . . I guess that would have been the logical choice. I never use that notation though, and the spreadsheet that I am creating is for people who would not understand R1C1 at all.Originally Posted by norie
her is the easyest way, witch wil work with any number big
Code:Public Function ColLett(Col As Integer) As String If Col > 26 Then ColLett = ColLett((Col - (Col Mod 26)) / 26) + Chr(Col Mod 26 + 64) Else ColLett = Chr(Col + 64) End If End Function
There are currently 1 users browsing this thread. (0 members and 1 guests)