ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Enabling a Embedded Control (https://www.excelbanter.com/excel-programming/276626-re-enabling-embedded-control.html)

Tim[_15_]

Enabling a Embedded Control
 
Kirk, try somnething like this. Note that the button will not be disabled
(Enabled = False), but that it just won't do anything unless the WksUpdated
function returns True.

Option Explicit

Private Sub CommandButton1_Click()
Dim WksUpdated As Boolean
If WksUpdated Then
MsgBox "It must be updated!" 'code to run if updated goes here
Else
MsgBox "Apparently not updated!"
End If
End Sub

Private Function WksUpdated() As Boolean
If Range("A1").Value = True Then 'example of "updated correctly"
WksUpdated = True
Else
WksUpdated = False
End If
End Function

"Kirk" wrote in message
...
I added a command button control to a spreadsheet. I
have it intially disabled, but want to enable it after
the spreadsheet has been updated correctly. I want to
enable it through VBA code. How do I do this? I'm sure
it is simple and I am overlooking something.

As always, all help is appreciated.

Thanks.

Kirk





All times are GMT +1. The time now is 11:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com