Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Action Event, CheckBox, Add Row and Textbox
Howdy,
Alright, here is an interesting one. I have a check box that follows a question in a questionnaire. The Checkbox is in a cell on the same row as the question. When this checkbox is ticked, I need a new row to be created underneath with a textbox to allow the user to give an explanation. Your Sincer Texas Aggie. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Action Event, CheckBox, Add Row and Textbox
Won't you have a problem if the user clicks on the checkbox, then unchecks it
and clicks on it again? Inserting a row each time the user checks the checkbox? If you want that, you can use a checkbox from the forms toolbar and a single macro. Make sure you put the checkboxes completely within the row and assign each checkbox this macro: Option Explicit Sub testme() Dim myCBX As CheckBox Set myCBX = ActiveSheet.CheckBoxes(Application.Caller) If myCBX.Value = xlOn Then myCBX.TopLeftCell.Offset(1, 0).EntireRow.Insert End If End Sub ======= Another option. Put the same checkboxes in the worksheet. But instead of inserting a new row, you could show a hidden row (or even hide the row). If you like that, you can use a macro like: Option Explicit Sub testme() Dim myCBX As CheckBox Set myCBX = ActiveSheet.CheckBoxes(Application.Caller) 'to toggle viewing the row. myCBX.TopLeftCell.Offset(1, 0).EntireRow.Hidden = CBool(myCBX.Value = xlOff) 'to make it visible and never hide it again. 'If myCBX.Value = xlOn Then ' myCBX.TopLeftCell.Offset(1, 0).EntireRow.hidden = false 'End If End Sub Ryan wrote: Howdy, Alright, here is an interesting one. I have a check box that follows a question in a questionnaire. The Checkbox is in a cell on the same row as the question. When this checkbox is ticked, I need a new row to be created underneath with a textbox to allow the user to give an explanation. Your Sincer Texas Aggie. -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Action Event, CheckBox, Add Row and Textbox
It never accured to me about ticking and unticking, thanks for the heads up.
I think the second option is going to work. THanks for your time, hopefully I will get to a point where I can help others as much as you have helped me. Thanks again. Your Sincer Texas Aggie. "Dave Peterson" wrote: Won't you have a problem if the user clicks on the checkbox, then unchecks it and clicks on it again? Inserting a row each time the user checks the checkbox? If you want that, you can use a checkbox from the forms toolbar and a single macro. Make sure you put the checkboxes completely within the row and assign each checkbox this macro: Option Explicit Sub testme() Dim myCBX As CheckBox Set myCBX = ActiveSheet.CheckBoxes(Application.Caller) If myCBX.Value = xlOn Then myCBX.TopLeftCell.Offset(1, 0).EntireRow.Insert End If End Sub ======= Another option. Put the same checkboxes in the worksheet. But instead of inserting a new row, you could show a hidden row (or even hide the row). If you like that, you can use a macro like: Option Explicit Sub testme() Dim myCBX As CheckBox Set myCBX = ActiveSheet.CheckBoxes(Application.Caller) 'to toggle viewing the row. myCBX.TopLeftCell.Offset(1, 0).EntireRow.Hidden = CBool(myCBX.Value = xlOff) 'to make it visible and never hide it again. 'If myCBX.Value = xlOn Then ' myCBX.TopLeftCell.Offset(1, 0).EntireRow.hidden = false 'End If End Sub Ryan wrote: Howdy, Alright, here is an interesting one. I have a check box that follows a question in a questionnaire. The Checkbox is in a cell on the same row as the question. When this checkbox is ticked, I need a new row to be created underneath with a textbox to allow the user to give an explanation. Your Sincer Texas Aggie. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Click event for checkbox from Forms toolbar | Excel Discussion (Misc queries) | |||
checkbox event handling function | Excel Worksheet Functions | |||
on particular action run a macro | Excel Discussion (Misc queries) | |||
How can I expose the TextBox BeforeUpdate event to my user class? | Excel Discussion (Misc queries) | |||
what is OLE.action | Excel Discussion (Misc queries) |