A computer with morals?...it doesn't want to "kill"

M

Michael Smith

The below code works fine on the 5 computers I've installed it on.
However, one computer is not liking the "kill" command, I've stepped
through and it kicks out of the sub once it hits the "Kill cell" line.
Any idea why?

Dim rng As Range, cell As Range
Set rng = Range(Cells(1, 3), Cells(1, 3).End(xlDown))
For Each cell In rng
If Dir(cell) <> "" Then
Kill cell
End If
Next

TIA,
Mike

*** Sent via Developersdex http://www.developersdex.com ***
 
G

Gary''s Student

Kill usually wants a string rather than a range. Maybe
dim s as string
s=cell.value (in the loop)
and then
kill s
 
T

Tom Ogilvy

Possibly the user doesn't have file permissions that would allow the file to
be deleted. Check with your network administrator. This isn't something
related to excel or VBA if it is the source of the problem.
 
T

Tom Ogilvy

Another thought - is it a read only file? Check using Windows Explorer.
Right click on the file and select view properties.
 
M

Michael Smith

Thanks for the advice all, but I've checked in to all your suggestions,
and none fix it. User's permissions on not restricted, files are not
read only, and tried kill as a string. It still hits the kill line, and
exits the macro. Any other thoughts?
Thanks so much for the posts!
-Mike

*** Sent via Developersdex http://www.developersdex.com ***
 

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