title: Excel VBA How to enable or disable checkboxes based on certain conditions by using vlookup
body: <p>I was trying to code in VBA to enable or disable the checkboxes for the mobile plan based on the brand selected as shown in the image. </p>
  
  <p><a href="https://i.stack.imgur.com/6uYll.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6uYll.png" alt="image"></a></p>
  
  <p>The table on the left acts as an indicator of the availability of the mobile plans for the respective brands as indicated by <code>"Y"</code> or <code>"N"</code>. For example, when the user selected <code>"Apple"</code> from the dropdown list, he is only allowed to tick the <code>Mobile Plan 1</code>.</p>
  
  <p>The attempted solution is based on only one criteria, which is for <code>"Apple"</code> in this case. How do I enhance the coding so that when the user selects <code>"Samsung"</code>, the status of the checkboxes will change accordingly? </p>
  
  <p>I planned to declare a variable as an <code>Integer</code> to act as an column indicator (for eg, <code>Apple = 2, Samsung = 3, Nokia = 4</code>)  and pass this integer to the each function <code>"CheckBox_Change"</code> and use the <code>VLOOKUP</code> function, but I get an error message: </p>
  
  <blockquote>
    <p>"procedure declaration does not match description of event or
    procedure having the same name"</p>
  </blockquote>
  
  <p>while I was trying to do so.    </p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  
  If Target.Address = "$G$1" Then
  
  CheckBox1.Value = False
  CheckBox2.Value = False
  CheckBox3.Value = False
  
  Call CheckBox1_Change
  Call CheckBox2_Change
  Call CheckBox3_Change    
  End If
  
  End Sub
  
  Private Sub CheckBox1_Change()
  
  If Range("B3").Value = "Y" Then
      CheckBox1.Enabled = True
  Else
      CheckBox1.Enabled = False
      CheckBox1.Value = False
  End If
  
  End Sub
  
  Private Sub CheckBox1_Click()
  
  If CheckBox1.Value = False Then
      Range("H3").Value = ""
  End If
  
  End Sub
  Private Sub CheckBox2_Change()
  
  If Range("B4").Value = "Y" Then
      CheckBox2.Enabled = True
  Else
      CheckBox2.Enabled = False
      CheckBox2.Value = False
  End If
  
  End Sub
  
  Private Sub CheckBox3_Change()
  
  If Range("B5").Value = "Y" Then
      CheckBox3.Enabled = True
  Else
      CheckBox3.Enabled = False
      CheckBox3.Value = False
  End If
  
  End Sub
  </code></pre>