Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default How I disable a command button until cell has value?

I have a workbook with many worksheets(25), on one
worksheet is a command button that when clicked locks all
cells in all worksheets, once all the data required is
entered. What I need is to disable this button until a
cell on the first worksheet has a specific value, can
anyone please help with the necessary code or macro?

The appropriate cell is E41 on sheet1, it has to have the
value "For Contract" to allow the button to be used.

Thank you in advance for any assistance.

Brian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default How I disable a command button until cell has value?

You did not post your code but maybe this 1st line will do it.
if sheet1!a1<12345 then exit sub

"Brian" wrote in message
...
I have a workbook with many worksheets(25), on one
worksheet is a command button that when clicked locks all
cells in all worksheets, once all the data required is
entered. What I need is to disable this button until a
cell on the first worksheet has a specific value, can
anyone please help with the necessary code or macro?

The appropriate cell is E41 on sheet1, it has to have the
value "For Contract" to allow the button to be used.

Thank you in advance for any assistance.

Brian



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default How I disable a command button until cell has value?

Hi,

you need to put some code to sheet1's worksheet_change event.

Private Sub Worksheet_Change(ByVal Target As Range)
if range("E41").value="For Contract" then
'assumed that commandbutton located on sheet2 and name is commandbutton1
sheet2.commandbutton1.enabled=true
end if
End Sub

--

To e-mail me, please remove AT and DOT from my e-mail address.



"Brian" , iletide sunu yazdi
...
I have a workbook with many worksheets(25), on one
worksheet is a command button that when clicked locks all
cells in all worksheets, once all the data required is
entered. What I need is to disable this button until a
cell on the first worksheet has a specific value, can
anyone please help with the necessary code or macro?

The appropriate cell is E41 on sheet1, it has to have the
value "For Contract" to allow the button to be used.

Thank you in advance for any assistance.

Brian



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How I disable a command button until cell has value?

Private Sub CommandButton1_Click()
if lcase(worksheets(1).Range("E41").Value < "for contract" then
msgbox "Worksheets are incomplete, can't lock at this time"
exit sub
End if
' your exisitng code

End Sub

It would be difficult to program code that would enable the commandbutton at
the appropriate time - probably easier just to have it do nothing (but warn
the user) until the condition is met.

--
Regards,
Tom Ogilvy


"Brian" wrote in message
...
I have a workbook with many worksheets(25), on one
worksheet is a command button that when clicked locks all
cells in all worksheets, once all the data required is
entered. What I need is to disable this button until a
cell on the first worksheet has a specific value, can
anyone please help with the necessary code or macro?

The appropriate cell is E41 on sheet1, it has to have the
value "For Contract" to allow the button to be used.

Thank you in advance for any assistance.

Brian



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default How I disable a command button until cell has value?

Thank you for your assistance, I have managed to get the
button working fine now.

Brian
-----Original Message-----
I have a workbook with many worksheets(25), on one
worksheet is a command button that when clicked locks

all
cells in all worksheets, once all the data required is
entered. What I need is to disable this button until a
cell on the first worksheet has a specific value, can
anyone please help with the necessary code or macro?

The appropriate cell is E41 on sheet1, it has to have

the
value "For Contract" to allow the button to be used.

Thank you in advance for any assistance.

Brian
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy cell by command button kalpesh Excel Worksheet Functions 1 December 28th 11 08:41 PM
how to disable/enable command button(ActiveX) using macro enahs_naneek Excel Discussion (Misc queries) 1 February 5th 10 12:32 PM
Command button depending on Cell Value Steve[_11_] Excel Discussion (Misc queries) 1 January 14th 08 11:34 AM
enable/disable button based on cell value Shoney Excel Discussion (Misc queries) 3 January 9th 08 07:34 PM
How do i clear a cell using a command button? Mariann Excel Discussion (Misc queries) 1 March 30th 06 09:15 PM


All times are GMT +1. The time now is 01:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"