PDA

View Full Version : Solved: Delete Row From UF



Emoncada
06-17-2009, 06:48 AM
I have a userform that will have a cmbbox that pulls data from a Range.

I currently have it as when a cmdbutton is clicked it sends all data from the userform to a Worksheet("Outgoing").

What I would like to is have it look at two cmbbox's on the UF and using that delete the entire row from another worksheet. (Kind of like a vlookup)

So it would looke at CmbBoxModel, then look at CmbBoxSN and with both that information look at the Worksheet that Matches the "CmbBoxModel" and find the "CmbBoxSN" and when found delete entire row. how can I do this.

Basically I want to remove it to show like it was done. So if the serial number is found in the "Outgoing" Worksheet then it needs to be removed from it's Model Worksheet.

Any help would be great thanks.

Bob Phillips
06-17-2009, 07:00 AM
Private Sub cmdOK_Click()
Dim RowNum As Long

With Worksheets(Me.CmbBoxModel.Value)

On Error Resume Next
RowNum = Application.Match(Me.CmbBoxSN.Value, .Columns(1), 0)
If RowNum = 0 Then

MsgBox "SN not found"
Else

.Rows(RowNum).Delete
End If
End With

End Sub

Emoncada
06-17-2009, 08:23 AM
That worked XLD Thanks Again.