PC Review


Reply
Thread Tools Rate Thread

Delete all Excel workbooks from a list on worksheet on condition.

 
 
u473
Guest
Posts: n/a
 
      27th Jul 2010
I need monthly to loop and delete all workbooks listed in column A,
(full path and file name is given) where column B content = "Y"
A B
File Delete
C:\Progress\ProjA.xls Y
C:\Progress\ProjB.xls
F:\Perf /ProjA\Elec.xls
F:\Perf /ProjA\Equip.xls Y
Help appreciated

J.P.
 
Reply With Quote
 
 
 
 
Don Guillett Excel MVP
Guest
Posts: n/a
 
      27th Jul 2010
On Jul 27, 11:21*am, u473 <u...@aol.com> wrote:
> I need monthly to loop and delete all workbooks listed in column A,
> *(full path and file name is given) where column B content = "Y"
> A * * * * * * * * * * * * * * * * * *B
> File * * * * * * * * * * * * * *Delete
> C:\Progress\ProjA.xls * * * *Y
> C:\Progress\ProjB.xls
> F:\Perf /ProjA\Elec.xls
> F:\Perf /ProjA\Equip.xls * * Y
> Help appreciated
>
> J.P.


Sub killem()
On Error Resume Next
For Each fn In Range("A2:A22")
If UCase(fn.Offset(, 1)) = "Y" Then Kill fn
End If
Next fn
End Sub
 
Reply With Quote
 
u473
Guest
Posts: n/a
 
      27th Jul 2010
Brilliant, and thank you again. I was cooking something much more
convoluted.
How would have it been different if path was in Column A, file name in
Column B, Type in Column C and Delete in Column D ?
Sub killem()
On Error Resume Next
For Each fn In Range("A2:A22")
If UCase(fn.Offset(, 4)) = "Y" Then
fn = fn..text + fn.Offset(, 1).text +fn.Offset(, 2).text
Kill fn
End If
Next fn
End Sub
Would t6hat syntax be correct ?
Thank you again,
J.P.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete worksheet row based on condition =?Utf-8?B?bWllaw==?= Microsoft Excel Programming 3 23rd Aug 2007 07:16 PM
Delete Worksheet Condition =?Utf-8?B?Vmlja2k=?= Microsoft Excel Programming 1 7th Nov 2006 04:13 PM
Generating a report list and statistic worksheet in Excel from other workbooks Gabrial.Carter@gmail.com Microsoft Excel Misc 1 20th Dec 2005 04:13 PM
From several workbooks onto one excel worksheet =?Utf-8?B?c3RldmU=?= Microsoft Excel Misc 6 1st Dec 2005 08:03 AM
Copying blank excel worksheet into additional excel workbooks =?Utf-8?B?RGVi?= Microsoft Excel Misc 10 4th Feb 2005 12:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:53 PM.