![]() |
Runtime Error
Rookie he Not sure what I'm doing wrong. I get a Runtime error 424
Object required on the wp.Rows(fnd.Row).Delete statement. Can someone tell how to fix this? Thanks Jody Private Sub btnDelete_Click() 'Search all Cells on the sheet for Me.cboPolkInOldNotInNew.Text Dim wp As Variant Set wp = Worksheets("PolkToCpMap").Range("PolkToCpMapNames" ) fnd = wp.Find(Me.cboPolkInOldNotInNew.Text) 'The find function returns a Range if the text is found or Nothing if it is not. If fnd = "" Then MsgBox "Text not Found" Else wp.Rows(fnd.Row).Delete End If End Sub |
Runtime Error
Hi SS,
Try: '============== Private Sub btnDelete_Click() Dim wp As Range Dim fnd As Range Set wp = Worksheets("PolkToCpMap"). _ Range("PolkToCpMapNames") On Error Resume Next fnd = wp.Find(Me.cboPolkInOldNotInNew.Text) On Error GoTo 0 If fnd Is Nothing Then MsgBox "Text not Found" Else wp.Rows(fnd.Row).Delete End If End Sub '<<============== --- Regards, Norman "ssjody" wrote in message oups.com... Rookie he Not sure what I'm doing wrong. I get a Runtime error 424 Object required on the wp.Rows(fnd.Row).Delete statement. Can someone tell how to fix this? Thanks Jody Private Sub btnDelete_Click() 'Search all Cells on the sheet for Me.cboPolkInOldNotInNew.Text Dim wp As Variant Set wp = Worksheets("PolkToCpMap").Range("PolkToCpMapNames" ) fnd = wp.Find(Me.cboPolkInOldNotInNew.Text) 'The find function returns a Range if the text is found or Nothing if it is not. If fnd = "" Then MsgBox "Text not Found" Else wp.Rows(fnd.Row).Delete End If End Sub |
All times are GMT +1. The time now is 12:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com