Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-23-2017, 10:37 AM
NoSparks NoSparks is offline Checkbox and Textbox Question Windows 7 64bit Checkbox and Textbox Question 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
 

Tags
#macros



Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox and Textbox Question Macro Needed to Insert Asnwer to A Question in Multiple Choice Format Question rsrasc Word VBA 7 03-28-2014 12:28 PM
Checkbox and Textbox Question Checkbox in Userform lukael Excel Programming 5 02-18-2014 05:20 AM
Checkbox and Textbox Question 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft