Sunday, April 14, 2019

Học lập trình VBA qua 17 chuyên đề - BÀI 2. LÀM VIỆC VỚI BIẾN TRONG VBA

Biến (variables) là gì  là một giá trị dữ liệu có thể thay đổi
Tên biến:
  •  Phải nhỏ hơn 25 ký tự
  •  Không có khoảng trống
  • Không được bắt đầu với con số
  • Thời gian sống
Kiểu biến
  • Dim password As String
  • Dim yourName As String *10
  • Dim firstnum As Integer
  • Dim secondnum As Integer
  • Dim total As Integer
  • Dim BirthDay As Date
Kiểu biến số:
Kieubienso-768x497



Kiểu biến số

Kiểu biến chuối:
Kieubienchuoi



Kiểu biến chuỗi

Toán tử
Toantu



Toán tử trong VBA

Ví dụ:
Private Sub CommandButton1_Click()
Dim YourName As String, BirthDay As Date, Income As Currency
YourName = “Alex”
BirthDay = “1 April 1980”
Income = 1000
Range(“A1”) = YourName
Range(“A2”) = BirthDay
Range(“A3”) = Income
End Sub

No comments:

Post a Comment

Over 50 Ebooks Excel and VBA free Download

1. Statistics and Probability for Engineering Applications With Microsoft Excel by W.J. DeCoursey - PDF Free Download Download Siz...