Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable command button


I have a command button that I have disabled unless a certain number is
entered.
but I need it disabled also if the cell is blank any ideas.

Here is the code thus far.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Sheets("Quality Accessing Template").Range("B6").Value = 0 And
Sheets("Quality Accessing Template").Range("B6").Value <= 9999 Then
Sheets("Quality Accessing Template").CommandButton1.Enabled = True

Else

Sheets("Quality Accessing Template").CommandButton1.Enabled = False

End If


End Sub


--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile: http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=380000

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Disable command button

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

With Sheets("Quality Accessing Template")
If Not IsEmpty(.Range("B6").Value) Then
If .Range("B6").Value = 0 And _
.Range("B6").Value <= 9999 Then
.CommandButton1.Enabled = True
Else
.CommandButton1.Enabled = False
End If
Else
.CommandButton1.Enabled = False
End If
End With
End Sub

--
HTH

Bob Phillips

"Mikeice" wrote in
message ...

I have a command button that I have disabled unless a certain number is
entered.
but I need it disabled also if the cell is blank any ideas.

Here is the code thus far.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Sheets("Quality Accessing Template").Range("B6").Value = 0 And
Sheets("Quality Accessing Template").Range("B6").Value <= 9999 Then
Sheets("Quality Accessing Template").CommandButton1.Enabled = True

Else

Sheets("Quality Accessing Template").CommandButton1.Enabled = False

End If


End Sub


--
Mikeice
------------------------------------------------------------------------
Mikeice's Profile:

http://www.excelforum.com/member.php...o&userid=22467
View this thread: http://www.excelforum.com/showthread...hreadid=380000



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Disable command button


Private Sub Worksheet_Change(ByVal Target As Range)
If Sheets("Quality Accessing Template").Range("B6").Value = 0 And
Sheets("Quality Accessing Template").Range("B6").Value <= 9999 And
Sheets("Quality Accessing Template").Range("B6") < "" Then

Sheets("Quality Accessing Template").CommandButton1.Enabled = True

Else

Sheets("Quality Accessing Template").CommandButton1.Enabled = False

End If

End Sub



Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=380000

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
how to disable/enable command button(ActiveX) using macro enahs_naneek Excel Discussion (Misc queries) 1 February 5th 10 12:32 PM
How disable menu command Armangelo Excel Discussion (Misc queries) 0 February 1st 06 10:00 AM
Disable Command Button when File name begins with Customer? RPIJG[_58_] Excel Programming 1 June 24th 04 05:53 PM
How I disable a command button until cell has value? Brian Excel Programming 4 October 21st 03 08:12 PM
Disable a command from with in a workbook Tony Pizza Excel Programming 0 July 22nd 03 12:42 AM


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

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"