PDA

View Full Version : run-time error '424'



don1
05-29-2006, 03:26 PM
vba beginner, the macro should work fine but if I want to close the file, get run-time error 424.
Any help ? Thanks
:dunno

Sub CopyName()
Dim rFound As Range
Dim rRnge As Range
Dim strName As String
Dim strCust As String
Set rRnge = Sheet1.Range("B3")
strName = Sheet1.Range("A1").Value
strCust = Sheet1.Range("B3").Value
Windows(2).Activate
On Error Resume Next
ActiveWorkbook.Sheets("Sheet1").Activate
Set rFound = Cells.Find(What:=strName, after:=Range("A1"), _
searchorder:=xlByRows, searchdirection:=xlNext, MatchCase:=False)
rFound.Select
rFound.Offset(0, 1).Value = strCust
rFound.Offset(0, 2).Value = rRnge.Offset(0, 1).Value
rFound.Offset(0, 3).Value = rRnge.Offset(0, 2).Value
rFound.Offset(0, 5).Value = rRnge.Offset(1, 0).Value
End Sub

matthewspatrick
05-29-2006, 05:37 PM
What is the text description for 424? If you hit debug when the error message comes up, which line do you go to?

don1
05-29-2006, 08:12 PM
Thank you for your quick response. The 424 error was solved, just mistyped somewhere. Sorry ! My real problem is error 9 "Subscript out of range", the line go to "Windows(2).Activate". I don't get an error If I first closed the activated makro file before the pasted data file. I think, the makro is still active even though the pasted data file was closed. Any idea how to clear this still active makro ? I hope you can understand my poor english.

Bob Phillips
05-30-2006, 02:13 AM
That is probably just a throw back to when you recorded it, you had two windows. Try just removing it.