#1
|
|||
|
|||
Hide rows with checkbox
OK...so I have a form with several rows that I would like to hide/show based on the value of a checkbox. There are some other checkboxes in this are that I want to hide with the rows that they are on. However, when I go to the Format Control: Properties, the Move and Size with cells option is grayed out. Any idea why that's happening?
Also, here is the macro... Code:
Private Sub cbClaimHide_Click() If cbClaimHide = True Then [47:53].EntireRow.Hidden = True Else: [47:53].EntireRow.Hidden = False End If End Sub |
#2
|
|||
|
|||
I really need an answer to this so I am going to post elsewhere. If I find a solution, I will update this thread.
|
#3
|
|||
|
|||
OK...so I figured out part of it. I was using a form control. I did the same with an ActiveX control and the hide/unhide worked swimmingly. Other than that, I really don't know what the difference is between the two types. Is there a way I can get this to work with the form control? Which type is better to use? Are there advantages of one over the other?
|
#4
|
|||
|
|||
gebobs,
ActiveX controls have arguably more properties that are readily set / read via the vba editor Properties pane and thus easy code. Coding for form control properties is perhaps not so obvious but there are several ways you can refer to them. One nice thing about using Form objects is that you can style and format them so much better than ActiveX Try coding for your form checkbox as below. Code:
Sub cbClaimHide_Click() If ActiveSheet.CheckBoxes("cbClaimHide").Value = 1 Then [47:53].EntireRow.Hidden = True Else: [47:53].EntireRow.Hidden = False End If End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Show/Hide Text based on Checkbox Selection | tammytran105 | Word VBA | 7 | 10-02-2014 04:30 PM |
Delete rows using checkbox in word | deboer | Word VBA | 5 | 06-22-2014 05:21 AM |
Hide Checkbox When Printing | vinceplunkett | Word | 1 | 12-03-2013 01:53 AM |
Hide Rows | YounesB3 | Excel | 2 | 10-29-2012 05:40 AM |
VBA for CheckBox to Hide Slides | mutchy25 | PowerPoint | 1 | 09-21-2012 01:40 AM |