Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
cru cru is offline
external usenet poster
 
Posts: 9
Default Hide/Unhide CommandButton by cell criteria

Can i have more than two range under SelectionChage?

I currently have this code but I got the first two range to work but the
third range does not work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("D18").Value = "YES" Then
Me.CommandButton13.Visible = True
Else
Me.CommandButton13.Visible = False
End If
If Range("D19").Value = "YES" Then
Me.CommandButton28.Visible = True
Else
Me.CommandButton28.Visible = False
End If
If Range("D21").Value = "YES" Then
Me.CommandButton29.Visible = True
Else
Me.CommandButton29.Visible = False
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Hide/Unhide CommandButton by cell criteria

Hi,

That should work perfectly but if it doesn't consider the following

the YES in the cells must be uppercase
Ensure you have the correct commandbutton number in your code
The use of ME isn't necessary but shouldn't cause a problem

Mike

"cru" wrote:

Can i have more than two range under SelectionChage?

I currently have this code but I got the first two range to work but the
third range does not work:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("D18").Value = "YES" Then
Me.CommandButton13.Visible = True
Else
Me.CommandButton13.Visible = False
End If
If Range("D19").Value = "YES" Then
Me.CommandButton28.Visible = True
Else
Me.CommandButton28.Visible = False
End If
If Range("D21").Value = "YES" Then
Me.CommandButton29.Visible = True
Else
Me.CommandButton29.Visible = False
End If
End Sub

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
Hide/Unhide with cell double click bones288 Excel Worksheet Functions 3 January 31st 12 07:47 PM
CommandButton used to hide and unhide rows Leiprecht Excel Discussion (Misc queries) 1 April 9th 09 06:05 PM
Hide or Unhide certain columns based on a cell value [email protected] Excel Programming 1 July 10th 06 10:17 AM
Macro to hide and unhide based on criteria [email protected] Excel Discussion (Misc queries) 1 June 5th 06 08:05 PM
Hide or Unhide Column Based on Cell Value windsurferLA Excel Programming 2 March 31st 06 11:06 PM


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

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

About Us

"It's about Microsoft Excel"