J
Jennifer
I am getting an error
Object does not support this property or method
Here is the code i am trying to use
Private Sub cmdDelete_Click()
If lstData.ListIndex = -1 Then Exit Sub
' Dim Index As String
Dim msg As String
Index = txtDataID.Text
msg = lstData.List(lstData.ListIndex, 1)
msg = msg & " " & lstData.List(lstData.ListIndex, 2)
msg = msg & " " & lstData.List(lstData.ListIndex, 3)
msg = msg & " " & lstData.List(lstData.ListIndex, 4)
If MsgBox(msg, vbYesNo + vbDefaultButton2, "DELETE #" & Index & " from "
& cboRation) = vbYes Then
RemoveItem Index
End If
End Sub
Private Sub RemoveItem(Index As String)
Dim found As Range
Dim ok As Boolean
With Worksheets("Rations")
For Each found In .Range(.Range("A2"), .Range("A2").End(xlDown))
If found = Index Then
ok = True
Exit For
End If
Next
End With
If ok Then
found.Resize(, 6).Delete xlShiftUp
LoadData
Else
MsgBox Index & " not found!"
End If
End Sub
Object does not support this property or method
Here is the code i am trying to use
Private Sub cmdDelete_Click()
If lstData.ListIndex = -1 Then Exit Sub
' Dim Index As String
Dim msg As String
Index = txtDataID.Text
msg = lstData.List(lstData.ListIndex, 1)
msg = msg & " " & lstData.List(lstData.ListIndex, 2)
msg = msg & " " & lstData.List(lstData.ListIndex, 3)
msg = msg & " " & lstData.List(lstData.ListIndex, 4)
If MsgBox(msg, vbYesNo + vbDefaultButton2, "DELETE #" & Index & " from "
& cboRation) = vbYes Then
RemoveItem Index
End If
End Sub
Private Sub RemoveItem(Index As String)
Dim found As Range
Dim ok As Boolean
With Worksheets("Rations")
For Each found In .Range(.Range("A2"), .Range("A2").End(xlDown))
If found = Index Then
ok = True
Exit For
End If
Next
End With
If ok Then
found.Resize(, 6).Delete xlShiftUp
LoadData
Else
MsgBox Index & " not found!"
End If
End Sub