Format Value Texbox
Format value sama halnya dengan format cell dilembar excel .Namun di userform pada texbox dikenal dgn format Value atau isi
Contoh beberapa format value pada texbox diantaranya
1 Format angka 8 digit
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
TextBox1.Value = Format(TextBox2.Value, "000000000000000")
End Sub
'2.Contoh format date atau tanggal :
Private Sub TextBox2_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
'Dim dDate As Date
dDate = DateSerial(Year(Date), Month(Date), Day(Date))
TextBox2.Value = Format(TextBox2.Value, "dd/mm/yyyy")
dDate = TextBox2Value
End Sub
'3.Contoh format Currency Mata Uang
Private Sub TextBox3_Change()
TextBox3.Value = Format(TextBox2.Value, "$#,##0.00")
End Sub
'4.Contoh format persen
Private Sub TextBox4_Change()
TextBox4.Value = Format(TextBox2.Value, "0.00%")
End Sub
'5,Contoh format menit
Private Sub TextBox5_Change()
TextBox5.Value = Format(TextBox5.Value, " h:mm:ss AM/PM;@")
End Sub
Selesai
Semoga bermanfaat
No comments:
Post a Comment