I want to change the properties of a button on a worksheet when the workbook
is opened so that if a cell contains a certain value the button is inactive
if the cell doesn't contain that value the button is active. I am using
Office XP.
Quick sample: (Paste into This Workbook module) of your file:
and change accordingly (cells and values)
Private Sub Workbook_Open()
With Worksheets(quot;Sheet1quot;)
.CommandButton1.Enabled = True
If .Range(quot;B4quot;).Value = 6 Then
.CommandButton1.Enabled = False
End If
End With
End Subquot;Billumsquot; wrote:
gt; I want to change the properties of a button on a worksheet when the workbook
gt; is opened so that if a cell contains a certain value the button is inactive
gt; if the cell doesn't contain that value the button is active. I am using
gt; Office XP.
Thanks for that. I have done this before (a long time ago) and when I tried
to do it now I couldn't get it to work. Why? Because I had omitted the period
at the beginning of the control name. :-(
quot;Jim Mayquot; wrote:
gt; Quick sample: (Paste into This Workbook module) of your file:
gt; and change accordingly (cells and values)
gt;
gt; Private Sub Workbook_Open()
gt; With Worksheets(quot;Sheet1quot;)
gt; .CommandButton1.Enabled = True
gt; If .Range(quot;B4quot;).Value = 6 Then
gt; .CommandButton1.Enabled = False
gt; End If
gt; End With
gt; End Sub
gt;
gt;
gt; quot;Billumsquot; wrote:
gt;
gt; gt; I want to change the properties of a button on a worksheet when the workbook
gt; gt; is opened so that if a cell contains a certain value the button is inactive
gt; gt; if the cell doesn't contain that value the button is active. I am using
gt; gt; Office XP.
- May 16 Wed 2007 20:37
How do I change activex control properties from a macro
close
全站熱搜
留言列表
發表留言