Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 124
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 124
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Click event for checkbox from Forms toolbar Carolyn Excel Discussion (Misc queries) 6 September 11th 06 08:16 PM
checkbox event handling function nevwalters Excel Worksheet Functions 2 May 16th 06 04:27 AM
on particular action run a macro Jelinek Excel Discussion (Misc queries) 1 February 3rd 06 01:21 PM
How can I expose the TextBox BeforeUpdate event to my user class? bereid Excel Discussion (Misc queries) 0 November 30th 05 05:00 PM
what is OLE.action Flute Excel Discussion (Misc queries) 1 December 2nd 04 09:04 PM


All times are GMT +1. The time now is 05:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"