Xlixen1
10-28-2007, 12:47 PM
I have attached the appropriate spreadsheet for what I want doing.
Basically,
I would like 8 checkboxes displaying 'Processor' (Already there) Motherboard, Memory etc.
When these checkboxes are unchecked, I would like the row that the checkbox corresponds to (For example, 'Processor' is row 15) to be hidden. When that box is checked, I would like that row to be unhidden. I wondered if this is possible to do with an IF statement from the 'True' or 'False' readings that the checkboxes give.
Otherwise, Is it possible to code macros to do this?
Thanks for any help anyone can give. I am most grateful :)
(Now Attached)
shades
10-28-2007, 03:25 PM
Howdy, and welcome to the board. Zip the file then attach
Xlixen1
10-30-2007, 08:45 AM
Okay thanks, have done.
Is there anyone who can help me?
Thanks.
shades
10-31-2007, 01:08 PM
The problem with your description is that once the row is hidden, there is no way for the person to check it in a hidden row. Unless you want a button to reset everything. But what would you reset it to? If to none, then the code will hide the row, so back to original problem.
Xlixen1
11-01-2007, 06:31 AM
I wanted the rows to be hidden by checking a checkbox. I intended for the checkboxes to be located above the rows that were being hidden.
I know it's difficult to explain what I would like. But basically, I want checkboxes above the selections, and when the checkboxes are checked, the selections are visible, and when unchecked they will be hidden.
If it would be easier I could do a screenshot and manipulate the image to show you what I would like =/
Thanks a lot.
shades
11-01-2007, 07:05 AM
Okay, now I understand. Thanks
Let me play with it a little. It is do-able. But I also have three projects to work on today. :)
Xlixen1
11-02-2007, 01:01 AM
Okay, Thanks a lot Shades :) Really appreciate it :)
whitespace
11-05-2007, 04:41 AM
You mean like the attached?
Just add that VB code but for other check boxes if so.
Sub Processor_Unhide()
Rows("15").Select
If Selection.EntireRow.Hidden Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
Is this what you meant?
whitespace
11-05-2007, 05:18 AM
Probably a better solution though is to use the VB control box (through toolbars / Visual Basic) and use the code below:
Private Sub Processor_Click()
On Error GoTo Processor_Err
Dim rn As String
Application.ScreenUpdating = False
' Store currently selected cell
rn = ActiveCell.AddressLocal
Rows("15").Select
If Processor.Value = True Then
' unhide the row
Selection.EntireRow.Hidden = False
Else
' hide the row
Selection.EntireRow.Hidden = True
End If
' return to cell selected prior to running macro
Range(rn).Select
Processor_Err:
Application.ScreenUpdating = True
End Sub
This works in a similar way but is more robust as whenever the check box is true it will show the row (whereas before the user could hide it and then it would mess up the checkbox value tallying with the row visibility).
Also, I've added a bit more code to return to the cell that was selected before you clicked the checkbox, and also to turn off the screen updating whilst it's hiding the row.
Hope this helps