title: Inserting checkbox, radio and dropdown values from VBA form into Excel spreadsheet
body: <p>I have a bit of a multi-faceted question regarding inserting checkbox, radio and dropdown values from a VBA form into the Excel spreadsheet. I am trying to accommodate a couple case scenarios in my code at the moment.</p>
  
  <p>The first set of items I want to insert is a <strong>checkbox</strong> with the following names/values:</p>
  
  <pre><code>Name         Value
  ==========   =====
  chk_week1    1
  chk_week2    2
  chk_week3    3
  chk_week4    4
  chk_week5    5
  chk_week6    6
  chk_week7    7
  chk_week8    8
  chk_week9    9
  chk_week10   10
  chk_week11   11
  chk_week12   12
  chk_week13   13
  chk_week14   14
  chk_week15   15
  </code></pre>
  
  <p>If the user makes a selection of several checkboxes then it should be inserted in the form <code>1,2,4,5</code> - for example if the user selects <code>chk_week1, chk_week2, chk_week4 and chk_week5</code>.</p>
  
  <hr>
  
  <p>The second set of items I want to insert is a single pick from radio group with the followng names/values within the frame <code>fr_Priority</code>:</p>
  
  <pre><code>Name         Value
  ==========   =====
  priority_y   Yes
  priority_n   No
  </code></pre>
  
  <p>So if the user selects <code>priority_y</code> then <code>Yes</code> is inserted into the Excel spreadsheet. </p>
  
  <hr>
  
  <p>The third set of items I want to insert comes from three drop downs. This is fairly straightforward, but the user is required to make a selection in all three drop downs. If they are not interested in a preference then they select <code>'No Preference'</code>. If the user makes this decision then nothing should be inserted into cell. The following names/values are present:</p>
  
  <pre><code>Name         
  ==========   
  cbo_fac1   
  cbo_fac2
  cbo_fac3   
  </code></pre>
  
  <p>For instance if the user makes a selection of <code>111,222,No Preference</code> in <strong>cbo_fac1</strong>, <strong>cbo_fac2</strong>, <strong>cbo_fac3</strong> then only <code>111,222</code> gets inserted. If <code>111,No Preference,No Preference</code> is selected then only <code>111</code> gets inserted. </p>
  
  <hr>
  
  <p>This is the code I am using right now:</p>
  
  <pre><code>Private Sub btnSubmit_Click()
  
  Dim ws As Worksheet
  Dim rng1 As Range
  Set ws = Worksheets("main")
  
  ' Copy the data to the database
  ' Get last empty cell in column A
  Set rng1 = ws.Cells(Rows.Count, "a").End(xlUp)
  
  deptCodeSplit = Split(cbo_deptCode.Value, " ")
  
  rng1.Offset(1, 0) = deptCodeSplit(0)
  rng1.Offset(1, 1) = cbo_moduleCode.Value
  rng1.Offset(1, 2) = cbo_moduleName.Value
  rng1.Offset(1, 3) = txt_studentNo.Value
  rng1.Offset(1, 4) = cbo_day.Value
  rng1.Offset(1, 5) = cbo_period.Value
  ' rng1.Offset(1, 6) = weeks
  rng1.Offset(1, 7) = cbo_weeks.Value
  rng1.Offset(1, 8) = cbo_semester.Value
  rng1.Offset(1, 9) = cbo_rounds.Value
  rng1.Offset(1, 10) = cbo_priority.Value
  ' rng1.Offset(1, 11) = lectureStyle
  rng1.Offset(1, 12) = txt_noRooms.Value
  rng1.Offset(1, 13) = cbo_park.Value
  ' rng1.Offset(1, 14) = fac
  ' rng1.Offset(1, 15) = pref
  rng1.Offset(1, 16) = txt_specialReq.Value
  
  End Sub
  </code></pre>
  
  <p>Thanks so much in advance!</p>