ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command button enabled dependant upon cell value (https://www.excelbanter.com/excel-programming/378353-command-button-enabled-dependant-upon-cell-value.html)

[email protected]

Command button enabled dependant upon cell value
 
Newbie question so take it easy boys and girls!

I have a command button on a worksheet which runs a macro and works
fine, but I want the button only to become enabled when the user has
entered a value into a cell.
How would I achieve this?


This is what I thought but it doesnt work whe

Worksheet name = PL3
Cell to have value = SUM_CHECK
command button = cmdAddToQuote
Macro to run = AddToQuote

Sheets("PL3").Select
If Range("SUM_CHECK").Value = 0 Then
cmdAddToQuote.Enabled = False
Else
cmdAddToQuote.Enabled = True

End If

Thanx in advance


cory

Command button enabled dependant upon cell value
 
Ian - The code that you have looks like it should work. Try stepping through
the program and check the value of Range("SUM_CHECK").Value to verify that
you enter the If statement at the correct times. If that is working as
expected then perhaps your command button is protected or on a different
worksheet.

" wrote:

Newbie question so take it easy boys and girls!

I have a command button on a worksheet which runs a macro and works
fine, but I want the button only to become enabled when the user has
entered a value into a cell.
How would I achieve this?


This is what I thought but it doesnt work whe

Worksheet name = PL3
Cell to have value = SUM_CHECK
command button = cmdAddToQuote
Macro to run = AddToQuote

Sheets("PL3").Select
If Range("SUM_CHECK").Value = 0 Then
cmdAddToQuote.Enabled = False
Else
cmdAddToQuote.Enabled = True

End If

Thanx in advance




All times are GMT +1. The time now is 07:08 AM.

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