By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,385 Members | 847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,385 IT Pros & Developers. It's quick & easy.

Run-time error '1004' when closing Excel

P: 4
Hello,

I've been getting this message when closing excel (not necessarily when closing the workbook by itself, but when closing Excel and the workbook at the same time):

--------------------------
Run-time error '1004':
Method of 'Worksheets' of object '_Global' failed
--------------------------

When I hit Debug, it highlights the code marked below:

--------------------------
Private Sub AttachSelect_Change()

Dim X As Integer
Dim Y As Integer

With Worksheets("Src").Range("A1:A100") ' This line highlighted
Set C = .Find(AttachSelect.Text, LookIn:=xlValues)
If Not C Is Nothing Then
firstAddress = C.Address
Do
X = C.Row
Y = Worksheets("Src").Cells(X, 3).Value
ActiveWindow.ScrollRow = Y
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> firstAddress
End If
End With

End Sub
--------------------------

Anyone have any ideas? The worksheet running the code is "Attachments" - not "Src"

If anyone has any ideas, I would love to kill this pesky message!!!

Thanks in advance
Oct 31 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.