Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi! I have a button which I use to delete ceratin rows from several sheets in
a workbook. If the button is pressed the user shall enter a date and the code finds the rows for that date and deletes them .This used to work but now I get "Error 1004. The Delete methd in Range class failed.". I dont know what has gone wrong. It gives me error on the row sh_Rows(i).Delete Public Sub deleteRow() 'deletes all rows for certain dates Dim sh_ As Worksheet Dim i As Long Dim intAnswer As Integer Dim strDate As String Dim strPswTry As String Dim strPsw As String strPsw = "sombrero" strDate = Application.InputBox(prompt:="Which date do you want to delete?", Type:=2) If strDate < "Falskt" Then strPswTry = Application.InputBox(prompt:="Enter password", Type:=2) 'If strPswTry = strPsw Then MsgBox "Password correct." For Each sh_ In ActiveWorkbook.Sheets For i = sh_.Cells(65536, 1).End(xlUp).Row To 1 Step -1 If sh_.Cells(i, 1).Value = strDate Then sh_.Rows(i).Delete End If Next i Next sh_ 'End If MsgBox "Password incorrect." End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run time error 1004 general odbc error excel 2003 vba | Excel Programming | |||
runtime error '1004' application or object defined error | Excel Programming | |||
Run Time 1004 Error: Application or Object Difine Error | Excel Programming | |||
run-time error '1004': Application-defined or object-deifined error | Excel Programming |