Skip to content

Instantly share code, notes, and snippets.

@blackstuend
Last active February 26, 2020 15:35
Show Gist options
  • Save blackstuend/88b86a562ffba1650acee426fa0ce9e9 to your computer and use it in GitHub Desktop.
Save blackstuend/88b86a562ffba1650acee426fa0ce9e9 to your computer and use it in GitHub Desktop.
Excel-Basic script

Learning basic excel vba

  • console.log
  1. Crtl+G 顯示終端機
Debug.Print "hello"
  • 獲得現在的位置
Application.ActiveWorkbook.Path
Application.ActiveWorkbook.FullName
  • 打開活頁簿
Workbooks.Open "test2.xlsx"
  • 選擇打開的活頁簿
  1. 裡面的1為第1個開的,從1開始
Workbooks(1).Activate
  • MsgBox 可以將內容呈現出來
    • 跟Debug.Print 差在
MsgBox "hello"
  • 獲得最後一列
Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
  • 獲得最後一欄
Cells(1, ActiveSheet.Columns.Count).End(xlToLeft).Column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment