Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Delete all Excel workbooks from a list on worksheet on condition.

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Delete all Excel workbooks from a list on worksheet on condition.

On Jul 27, 11:21*am, u473 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Delete all Excel workbooks from a list on worksheet on condition.

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
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
how to delete an excel line based on a condition The cricket Excel Worksheet Functions 2 October 7th 08 12:04 PM
Delete worksheet row based on condition miek Excel Programming 3 August 23rd 07 07:16 PM
Delete Worksheet Condition Vicki Excel Programming 1 November 7th 06 04:13 PM
How to delete Excel worksheet using VBA without delete dialog? cocalico22 Excel Programming 4 September 15th 06 10:34 PM
Generating a report list and statistic worksheet in Excel from other workbooks [email protected] Excel Discussion (Misc queries) 1 December 20th 05 04:13 PM


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

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

About Us

"It's about Microsoft Excel"