0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

エクセル列の数値→アルファベット変換

Posted at

エクセルの列番号を数値からもとめます。

自分用のメモです。
用途は色々あると思います。
セルのxとyを数値でやると直感的にわかりにくいので嫌だなという時とかに使います。
.Netで利用できるExcelCreator とか VBReportとかで使っています。

vb.net
Dim n2a = Function(num As Integer)
              Dim en As String() = {"", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
              Dim a As String = en(Math.Floor(num / 26))
              Dim b As String = en(num Mod 26)
              Return a & b
          End Function
Dim hoge = n2a(1) 'A
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?