title: Adding checkboxes from VBA form into Excel spreadsheet
body: <p>I am trying to fill a range that is unknown in size, as a user can choose up to 15 items in the first set. This will be inserted into a certain row.</p>
  
  <p>I have a checkbox with the following names/values:</p>
  
  <pre><code>Name         Value
  ==========   =====
  chk_week1    1
  chk_week2    2
  ...          ...
  ...          ...
  chk_week15   15
  </code></pre>
  
  <p>For example if the user selects <strong>chk_week1</strong>, <strong>chk_week2</strong>, <strong>chk_week4</strong> and <strong>chk_week5</strong>, then it should be inserted into the cell as 1,2,4,5.</p>
  
  <p>I've included an image how it looks like to better demonstrate it:</p>
  
  <p><img src="https://i.stack.imgur.com/sfYyK.png" alt="enter image description here"></p>
  
  <p>Each checkbox has the name and value listed in the table above. Here is the code I am using so far:</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, " ")
  
  ' Having difficulty adding the code here
  ' rng1.Offset(1, 6) = weeks
  
  End Sub
  </code></pre>