LoginSignup
2
2

More than 5 years have passed since last update.

Excelでワークシート名をセルに表示

Last updated at Posted at 2012-06-21

=RIGHT(CELL("filename",$A$1),LEN(CELL("filename",$A$1))-FIND("]",CELL("filename",$A$1)))

どのセルでも同じ(A1を絶対値指定してる)。
やっている内容は、セルの情報をファイルネームごと(ワークシート名も入っている)もってきて
「]」の位置を見極めて、右から文字列を取得している

※ファイル名やフォルダ名に「]」が含まれていると、正しく取得ができない…
その場合は、ユーザー関数を使うしかないかな。

SheetName()
Function SheetName() As String
 Application.Volatile
 SheetName = Application.Caller.Parent.Name
End Function
2
2
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
2
2