Function to convert column number to letter?

后端 未结 28 1857
灰色年华
灰色年华 2020-11-22 07:04

Does anyone have an Excel VBA function which can return the column letter(s) from a number?

For example, entering 100 should return CV.

28条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 07:32

    This is a function based on @DamienFennelly's answer above. If you give me a thumbs up, give him a thumbs up too! :P

    Function outColLetterFromNumber(iCol as Integer) as String
        sAddr = Cells(1, iCol).Address
        aSplit = Split(sAddr, "$")
        outColLetterFromNumber = aSplit(1)
    End Function
    

提交回复
热议问题