Run-time Error '1004'

G

Guest

I get the follow error

Run-Time error '1004'
Select method of Range class failed.

In highlights this line, which is toward the end of the code.

Sheet1.Range("A" & found & ":I" & found).Select

There is the code for the button.

Private Sub DeleteProdType_Click()

test_row = 2
test_value = Sheet1.Range("A" & test_row).Value

While test_value <> ""
If test_value = UserForm1.ComboBox2.Value Then
found = test_row
GoTo leaveloop1
End If
test_row = test_row + 1
test_value = Sheet1.Range("A" & test_row).Value
Wend

leaveloop1:
test_row2 = 1
test_value2 = Sheet2.Range("A" & test_row2).Value

While test_value2 <> ""
test_row2 = test_row2 + 1
test_value2 = Sheet2.Range("A" & test_row2).Value
Wend


Sheet1.Range("A" & found & ":H" & found).Copy
Sheet2.Range("A" & test_row2).PasteSpecial
Sheet2.Range("I" & test_row2) = Date

UserForm1.ComboBox2.Clear

Sheet1.Range("A" & found & ":I" & found).Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp

ComboBoxRefresh

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top