返回列表 上一主題 發帖

[請教]EXCEL 一執行 即動作

[請教]EXCEL 一執行 即動作

EXCEL開啟後
馬上執行下面按鈕的碼
要如何執行
VB要如何寫

例如:要如何在 This Workbook裡設定執行...等

Option Explicit
Const 灰色 = &H8000000F

Private Sub CommandButton4_Click()
CommandButton4.BackColor = vbGreen
       CommandButton1.BackColor = 灰色
       CommandButton2.BackColor = 灰色
       CommandButton3.BackColor = 灰色
End Sub

本帖最後由 bqwangs 於 2014-3-13 20:38 編輯

我已經有開啟你說的那個
我是指Private Sub Workbook_Open()
無法放入顏色的語法
所以我把語法放進按鈕裡
===============
Private Sub CommandButton4_Click()
CommandButton4.BackColor = vbGreen
       CommandButton1.BackColor = 灰色
       CommandButton2.BackColor = 灰色
       CommandButton3.BackColor = 灰色
End Sub
===============
那要如何一開始EXCEL就會執行那個按鈕的語法

Private Sub Workbook_Open()
    Range("B1").Select
End Sub

TOP

謝謝搞定了

TOP

http://forum.twbts.com/thread-11073-1-1.html
http://forum.twbts.com/thread-11311-1-1.html
能請教嗎??
如果判斷C5為1 或 0 或 -1
分別去執行按鈕1 按鈕2 按鈕3
程式碼可能會簡單些
請教該如何寫

TOP

        靜思自在 : 我們最大的敵人不是別人.可能是自己。
返回列表 上一主題