ThisWorkbook.Path數組 |
獲取當前目錄spa |
sheetXXX.UsedRange.Rows.Countexcel |
獲取當前sheet頁使用的行數code |
|
|
MsgBox("hello world")orm |
彈窗事件 |
Dim data As Worksheet Set data = Sheets("錄入表") |
定義 |
Debug.printci |
當即窗口get |
Dim targetarray() As Stringit |
定義數組 |
IsNumeric(mtotalcharge) |
判斷是數字 |
originArray = Split(origin, Chr(10)) |
用回車來分割 |
UBound(originArray) |
數組最大下標 |
LBound(originArray) |
數組最小下標 |
Dim i As Integer For i = LBound(originArray) To UBound(originArray) If i = 2 Then Exit For Debug.Print originArray(i) Debug.Print "-----------" Next |
循環數組 跳出數組 |
Cstr |
轉換成文本 |
Dim date1 As Date date1 = sheetSource.Range("A1").Value datestr = UCase(Format(date1, "ddMMM"))
|
日期格式化 |
UCase |
大寫 |
Cells(24, 4) |
根據行號列號選中單元格 |
sheet_FHL.Range("b2", "c2").Clear |
清理數據 |
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$B$4" Then |
單元格內回車觸發事件 |
Sub createFile() |
生成excel文件 |