Check Box or other table to populate individual cells.

rodin24

New Member
Joined
Apr 15, 2015
Messages
1
Hello. I need to create a checkbox that will be comprised of instrument names (piano, guitar, drum, et al.). When an instrument is selected, I need it to populate one cell. If multiple instruments are selected, the text needs to be in the same cell, e.g. if I select PIANO; DRUMS; GUITAR, the cell needs to read "Piano; Guitar; Drums" or similar.

What I'm doing is tagging a list of songs (2,000 titles). The instrument list is pre-determined and rather than type out each instrument in a cell, I'd like to be able to populate the "Instrument" column cell for each track with a check box (or similar table/function).

Is there a way to do this?

Thank you.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hello,

You will need a userform with 1 label, checkboxes for each instrument and 1 command button.

Set the label name to lblTrack.

Set the check boxes to chkDrums etc

In a standard module, enter this code

Code:
Global MY_ROW As Single
Global MY_TRACK As Variant
Sub OPEN_FORM()
    MY_ROW = ActiveCell.Row
    MY_TRACK = ActiveCell.Value
    UserForm1.chkDrums.Value = False
    UserForm1.chkGuitar.Value = False
    UserForm1.chkPiano.Value = False
    UserForm1.lblTrack.Caption = MY_TRACK
    UserForm1.Show
End Sub

in the userform code window, enter this code

Code:
Private Sub CommandButton1_Click()
    MY_TEXT = ""
    If chkDrums.Value = True Then
        MY_TEXT = "DRUMS"
    End If
    If chkGuitar.Value = True Then
        MY_TEXT = MY_TEXT & "; GUITAR"
    End If
    If chkPiano.Value = True Then
        MY_TEXT = MY_TEXT & "; PIANO"
    End If
    Sheets("Sheet1").Range("B" & MY_ROW).Value = MY_TEXT
    UserForm1.Hide
End Sub

I have assumed the track is in column A and the 'instruments' will go in column B.

On Sheet 1, place a command button.

To run the code, place the cursor on a cell with a track and press the command button on the sheet. Select the relevant check boxes, and press the command button.

Is this of any use?
 
Upvote 0

Forum statistics

Threads
1,226,230
Messages
6,189,768
Members
453,568
Latest member
LaTwiglet85

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top