ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   I need help with macros and check boxes. (https://www.excelbanter.com/new-users-excel/78356-i-need-help-macros-check-boxes.html)

Marc

I need help with macros and check boxes.
 
I can record a macro to hide or unhide columns or cells but I need to
reverse the process when the button toggles to the other position. I need
the cells to be hidden until the box is "checked" but hide if it gets
unchecked.

Marc



Mel Arquiza

I need help with macros and check boxes.
 
Hi Marc,

Try this:

Placed a check box on excel and paste this code below:

Private Sub CheckBox1_Click()
Range("A1").Select 'Active Cell Select
If CheckBox1.Value = True Then
Selection.EntireRow.Hidden = True
Else: CheckBox1.Value = False
Selection.EntireRow.Hidden = False
End If
End Sub

Hope this helps.

"Marc" wrote:

I can record a macro to hide or unhide columns or cells but I need to
reverse the process when the button toggles to the other position. I need
the cells to be hidden until the box is "checked" but hide if it gets
unchecked.

Marc




Marc

I need help with macros and check boxes.
 
Mel thanks! It dawned on me after I sent the post if I used the check boxes
from the "Forms" not the "Control Toolbox" I could get a true false and use
that to make the changes but yours is more elegant.

Marc

"Mel Arquiza" wrote in message
...
Hi Marc,

Try this:

Placed a check box on excel and paste this code below:

Private Sub CheckBox1_Click()
Range("A1").Select 'Active Cell Select
If CheckBox1.Value = True Then
Selection.EntireRow.Hidden = True
Else: CheckBox1.Value = False
Selection.EntireRow.Hidden = False
End If
End Sub

Hope this helps.

"Marc" wrote:

I can record a macro to hide or unhide columns or cells but I need to
reverse the process when the button toggles to the other position. I

need
the cells to be hidden until the box is "checked" but hide if it gets
unchecked.

Marc







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

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