Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete combo box entry

Status
Not open for further replies.

techie131

MIS
Jun 23, 2005
60
CA
I have a data input program in excel that uses a combo box to select the entries. What I would like to do is add some coding so that once they select the combobox entry and hit the button to enter the data to excel it will delete that entry which is located in a another sheet within the workbook. Can someone tell me how I would code that
 
hi
you could adapt something like the code below where cboData is my combo and the range "combodata" is an xl range used for the combo's rowsource


Code:
Private Sub cmdOK_Click()
Dim lRow As Long
Dim c As Range

If IsEmpty([Sheet1].Cells(1, 2)) Then
    lRow = 1
Else
    lRow = [Sheet1].[b65536].End(xlUp).Row + 1
End If
[Sheet1].Cells(lRow, 2) = cboData.Value

Set c = Range("combodata").Cells.Find(cboData.Value)
c.Delete (xlUp)
End Sub

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top