- 帖子
- 38
- 主題
- 4
- 精華
- 0
- 積分
- 65
- 點名
- 0
- 作業系統
- Window7
- 軟體版本
- office2010
- 閱讀權限
- 20
- 性別
- 男
- 來自
- Taipei
- 註冊時間
- 2011-12-16
- 最後登錄
- 2013-12-13
|
請教各為先進, 小弟程式碼如下, 原本小弟想使用For.....Next迴圈來判斷C欄是否有資料並控制 CommandButton顯示與否
但是卡在 控制項物件的部份, 小弟不會使用For...Next來寫...再請各位先進指導一下.
另外因所有的sheet都會用到該程式, 因此小弟新增於一般模組, 可是每當執行後, 會出現"此處需要物件"的錯誤訊息
看Excel的說明說我少了指定的定位項, 小弟不太瞭解定位項的意思以及該放在那邊...有勞各位先進開導, 謝謝!!- Sub RemoveButton()
- If [C3] <> "" Then
- CommandButton2.Visible = True
- Else
- CommandButton2.Visible = False
- End If
- If [C4] <> "" Then
- CommandButton3.Visible = True
- Else
- CommandButton3.Visible = False
- End If
- If [C5] <> "" Then
- CommandButton4.Visible = True
- Else
- CommandButton4.Visible = False
- End If
- If [C6] <> "" Then
- CommandButton5.Visible = True
- Else
- CommandButton5.Visible = False
- End If
- If [C7] <> "" Then
- CommandButton6.Visible = True
- Else
- CommandButton6.Visible = False
- End If
- If [C8] <> "" Then
- CommandButton7.Visible = True
- Else
- CommandButton7.Visible = False
- End If
- If [C10] <> "" Then
- CommandButton8.Visible = True
- Else
- CommandButton8.Visible = False
- End If
- If [C11] <> "" Then
- CommandButton9.Visible = True
- Else
- CommandButton9.Visible = False
- End If
- If [C12] <> "" Then
- CommandButton10.Visible = True
- Else
- CommandButton10.Visible = False
- End If
- If [C13] <> "" Then
- CommandButton11.Visible = True
- Else
- CommandButton11.Visible = False
- End If
- If [C14] <> "" Then
- CommandButton12.Visible = True
- Else
- CommandButton12.Visible = False
- End If
- If [C15] <> "" Then
- CommandButton13.Visible = True
- Else
- CommandButton13.Visible = False
- End If
- If [C16] <> "" Then
- CommandButton14.Visible = True
- Else
- CommandButton14.Visible = False
- End If
- If [C17] <> "" Then
- CommandButton15.Visible = True
- Else
- CommandButton15.Visible = False
- End If
- End Sub
複製代碼 |
|