43
2019 Excel VBA For Mac (Note 2)

2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

2019 Excel VBA For Mac (Note 2)

Page 2: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

叫出 Developer

Page 3: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw
Page 4: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw
Page 5: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

結果畫面

Page 6: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

錄製巨集

Page 7: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw
Page 8: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

輸入需要「重複做」的工作

Page 9: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

停止錄製

Page 10: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

開啟巨集(左邊為錄製)

Page 11: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

選擇要跑的巨集

Page 12: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

自動跑出來!

=SUM(C1:C3)

Page 13: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

錄製、使用巨集影片示意

Page 14: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

編輯巨集 VBA 語法

Page 15: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw
Page 16: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

跳出 VB Editor 視窗

Page 17: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

逐步檢視巨集 VBA 語法

Page 18: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw
Page 19: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

跳出視窗(有反黃為目前步驟)

Page 20: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

點選「逐行檢視」等就會繼續往下跑

Page 21: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

在 Mac 中存帶有巨集的檔案

Page 22: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

選擇 .xlsm 結尾的檔案類型

Page 23: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

下次開啟檔案時就會詢問要不要啟用巨集

Page 24: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

打開 Visual Basic Editor

Page 25: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

Visual Basic Editor 視窗畫面

Page 26: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

功能區

跑程式使用

寫程式使用

Page 27: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

逐行、段落檢視程式碼

Page 28: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

逐行、段落檢視的快捷鍵

Page 29: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

新增監看視窗

Page 30: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

或選取想監看的值按右鍵

Page 31: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

設定監看視窗

Page 32: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

監看視窗 開始跑程式後會出現數值

Page 33: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

叫出規劃求解 Solver 按鈕

Page 34: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw
Page 35: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

在資料分析 tab 中會出現規劃求解

Page 36: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

有哪個作業需要用到規劃求解的話(上課會講解)

Page 37: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

將過程以巨集錄製

Page 38: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

再複製到按鈕的 VBA 程式碼中

Page 39: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

跑程式之前要在 VB Editor 中打開 Solver

Page 40: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

打勾、OK 就完成了

Page 41: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

使用英文版-老師的 VBA 註解變亂碼基本上不影響程式

Page 42: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

如果 Mac 可能跑不動這個 VBA read only 還是可以看到程式碼

Page 43: 2019 Excel VBA For Mac (Note 2) - homepage.ntu.edu.tw

VBA button 按不下去將程式碼複製並新增㇐個 button

原本的按鈕

新增的按鈕