#1
|
|||
|
|||
Checkbox and Textbox Question
I have a project and I would like to put some enhancement with this. I have a Checkbox "Other" then if the user click or chose that Checkbox the user is required to put some additional comment to the separate textbox. I would like to ask on how to code that if I click the submit button it will transfer the information to database on a blank rowI had already a existing code, I just would like to add the Textbox "Additional Comment". Please see attached file. Quality Tool.xlsm
Thank you |
#2
|
|||
|
|||
Your profile indicates having Office 2010 64bit.... are you sure.
I do, and the file you've attached won't run on 64bit Excel. Seeing this question is also posted on MrE and is 5 pages deep at EF you should take a moment and read this http://www.excelguru.ca/content.php?184 |
#3
|
|||
|
|||
You are currently looping through all controls looking for check boxes, if the check box is True, you are copying its Captain to column 7.
You'll need to look at that captain to decide if you want to copy the caption to column 7 or the text from the associated text box to column 8, or maybe do both. Perhaps something along the lines of Code:
' Attributes Target For Each ctrl In Me.Controls Select Case TypeName(ctrl) Case Is = "CheckBox" If Me.Controls(ctrl.Name).Value = True Then 'if it is not an 'Other' chkbox If Me.Controls(ctrl.Name).Caption <> "Other" Then .Offset(RowCounter, 7).Value = vbCrLf & Me.Controls(ctrl.Name).Caption RowCounter = RowCounter + 1 Else 'get number from chkbox name 'dim num at beginning of sub as string num = Mid(ctrl.Name, 9) .Offset(RowCounter, 7).Value = vbCrLf & Me.Controls(ctrl.Name).Caption .Offset(RowCounter, 8).Value = Me.Controls("Textbox" & num).Value RowCounter = RowCounter + 1 End If End If End Select Next ctrl |
#4
|
|||
|
|||
For Checkbox "Other" and Textbox "Additional Comment" it should be both copied to a cell. I'll try this one. Thank you and Have a great day!
|
#5
|
|||
|
|||
Wow! Thanks its Working!!
|
#6
|
|||
|
|||
I have a follow up question with regards to Start and Time, What if the user was not completely done with his activity and he wants to tag his work as pending due to some circumstance (Brea, Lunch, Team Meeting and Coaching) I cant visualize on how to create start pause and time sequence. Thank you!
|
Tags |
#macros |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro Needed to Insert Asnwer to A Question in Multiple Choice Format Question | rsrasc | Word VBA | 7 | 03-28-2014 12:28 PM |
Checkbox in Userform | lukael | Excel Programming | 5 | 02-18-2014 05:20 AM |
Display result in textbox based on the input of another textbox | scarymovie | Word VBA | 5 | 05-16-2012 07:05 PM |
macro on checkbox | macrohelp | Word VBA | 0 | 03-06-2009 03:33 PM |
resizing a checkbox?? | aceensor | Excel | 0 | 05-10-2006 01:44 PM |