If I add End If I get a 'End if without block if' error. If I remove the End If I get 'Block If without End If'. Can anyone tell me how to end this please?
Private Sub ListBox1_Click()
If Me.ListBox1.ListIndex = -1 Then 'not selected
MsgBox " No selection made"
If Me.ListBox1.ListIndex >= 1 Then 'User has selected
r = Me.ListBox1.ListIndex
With Me
Set c = Range("a65536").End(xlUp).Offset(1, 0)
.TextBox1.Value = ListBox1.List(r, 0)
.TextBox2.Value = ListBox1.List(r, 1)
.TextBox3.Value = ListBox1.List(r, 2)
.TextBox4.Value = ListBox1.List(r, 3)
.cmbAmend.Enabled = True 'allow amendment or
.cmbDelete.Enabled = True 'allow record deletion
.cmbAdd.Enabled = False 'don't want duplicate
If c.Offset(0, 4).Value = "1.ABYLT" Then Me.CheckBox1.Value = True
If c.Offset(0, 4).Value = "" Then Me.CheckBox1.Value = False
If c.Offset(0, 5).Value = "2.ABRAYLT" Then Me.CheckBox2.Value = True
If c.Offset(0, 5).Value = "" Then Me.CheckBox2.Value = False
If c.Offset(0, 6).Value = "3.ABWTT" Then Me.CheckBox3.Value = True
If c.Offset(0, 6).Value = "" Then Me.CheckBox3.Value = False
End With
End If
End Sub
Bookmarks