View Single Post
 
Old 03-23-2017, 10:37 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

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
Reply With Quote