![]() |
Run-time Error '1004'
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 |
Run-time Error '1004'
Try inserting
Sheet1.Activate right before the offending line. Regards, Steve Chris schrieb: 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 |
All times are GMT +1. The time now is 09:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com