Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 788
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Time Error 1004: Application or Object Defined Error BEEJAY Excel Programming 4 October 18th 06 04:19 PM
Run Time 1004 Error: Application or Object Difine Error BEEJAY Excel Programming 0 October 17th 06 10:45 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Run time error '1004': Generaol ODBC error Dwaine Horton[_3_] Excel Programming 2 April 26th 05 02:52 PM


All times are GMT +1. The time now is 01:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"