RANGE.NumberFormatLocal 這個屬性可以做時間資料格式設定,若沒有使用NumberFormatLocal 屬性,也可以直接透過FORMAT函數,直接針對資料做設定;EX:FORMAT(NOW(),"YYYY/MM/DD")
小編簡單作兩個按鈕一個是切換年月日,另外一個是切換年月日時分。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub CommandButton1_Click() | |
ActiveSheet.Range("B2").NumberFormatLocal = "EE/MM/DD" | |
ActiveSheet.Range("B3").NumberFormatLocal = "YYYY/MM/DD" | |
End Sub | |
Private Sub CommandButton2_Click() | |
ActiveSheet.Range("B2").NumberFormatLocal = "YYY/MM/DD HH:MM" | |
ActiveSheet.Range("B3").NumberFormatLocal = "YYYY/MM/DD HH:MM" | |
End Sub |
沒有留言:
張貼留言