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.

VBAで日付をYYYYMMDDの8桁数値で表示する

Posted at

現在の日付を取得して、スラッシュ抜きのYYYYMMDD形式に変換し、メッセージボックスに表示するマクロです。

Sub eight_digits_date() 'マクロのタイトルを「eight_digits_date」と名づける
    Dim Date8 As String 'String(文字列)型の変数「Date8」を宣言
    Date8 = Format(Now, "yyyymmdd") 'Now関数を使って、yyyymmdd形式で日付を取得し、変数「Date8」に格納
    MsgBox Date8 'メッセージボックスで変数「Date8」の中身を表示
End Sub
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?