ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command Button Invisible (https://www.excelbanter.com/excel-programming/450590-command-button-invisible.html)

Excel_Fan

Command Button Invisible
 
I have a spreadsheet of names that need to be sorted ONLY between the dates of January 1 and January 15 each year. I have a command button with a macro to do that and it works fine. I want the Command Button to become invisible (and also disabled) for the remainder of the year, then become visible and enabled January 1 the next year. Is this possible? I have no idea how to approach this task. Thanks in advance.

GS[_2_]

Command Button Invisible
 
I have a spreadsheet of names that need to be sorted ONLY between the
dates of January 1 and January 15 each year. I have a command button
with a macro to do that and it works fine. I want the Command Button
to become invisible (and also disabled) for the remainder of the
year, then become visible and enabled January 1 the next year. Is
this possible?


Yes/Yes if it's an ActiveX button from the Controls Toolbox. Yes/No if
it's a button from the Forms controls as these don't have an Enabled
property...

With ActiveSheet.CommandButton1
.Visible = False: .Enabled = False
End With 'ActiveSheet.CommandButton1

...though if you hide it I don't see why you need to disable it!

ActiveSheet.Shapes("Button 1").Visible = False

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




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

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