ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide control until report section populates (https://www.excelbanter.com/excel-programming/434307-hide-control-until-report-section-populates.html)

Greg Snidow

Hide control until report section populates
 
Greetings all. I have a command button, Button10, that clears out a range.
The range to be cleared is populated by a solver macro, and I don't want the
clear button to be visible until the range is populated with the results of
the solver bit. Then, once the range is cleared, I want the button to be
invisible again. Thanks for any suggestions.

Greg

Jacob Skaria

Hide control until report section populates
 
Identify a cell in the range which will not be blank when data is populated
by the solver macro. Suppose the cell is C8; try the below. Select the sheet
tab which you want to work with. Right click the sheet tab and click on 'View
Code'. This will launch VBE. Paste the below code to the right blank portion.
Get back to to workbook and try out.


Private Sub CommandButton10_Click()
Range("C8").ClearContents
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton10.Visible = Not (Range("C8") = "")
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Greg Snidow" wrote:

Greetings all. I have a command button, Button10, that clears out a range.
The range to be cleared is populated by a solver macro, and I don't want the
clear button to be visible until the range is populated with the results of
the solver bit. Then, once the range is cleared, I want the button to be
invisible again. Thanks for any suggestions.

Greg


Greg Snidow

Hide control until report section populates
 
Thanks Jacob, but it does not like that. I guess I am thinking in Access,
where I would just do 'Me.Button10.visible = false' as the last line in the
buttons code. This brings me to another question. How can I see the
properties of the button? I added it from the developer toolbar, but I can't
figure out how to, say for example, change the button name?

"Jacob Skaria" wrote:

Identify a cell in the range which will not be blank when data is populated
by the solver macro. Suppose the cell is C8; try the below. Select the sheet
tab which you want to work with. Right click the sheet tab and click on 'View
Code'. This will launch VBE. Paste the below code to the right blank portion.
Get back to to workbook and try out.


Private Sub CommandButton10_Click()
Range("C8").ClearContents
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
CommandButton10.Visible = Not (Range("C8") = "")
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Greg Snidow" wrote:

Greetings all. I have a command button, Button10, that clears out a range.
The range to be cleared is populated by a solver macro, and I don't want the
clear button to be visible until the range is populated with the results of
the solver bit. Then, once the range is cleared, I want the button to be
invisible again. Thanks for any suggestions.

Greg



All times are GMT +1. The time now is 02:45 PM.

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