excel vba
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel VBA

Excel VBA

resolvedResolved · Low Priority · Version 2003

replyReplyTue 23 Feb 2010, 09:39Delegate Frazer said...

Excel VBA

I have written a mcro to delete files from a shared drive. The macro selects files according to name criteria provided by the user but I also want to select by the file's last modified date. How can I do this ? Here is the code so far:

Sub Killer()
'macro to select & delete specific files
Dim Response As String
Dim datmod As Date
'Dim varNow As Variant 'the user form is shown & each button returns a different varNow value


Set fs = Application.FileSearch
With fs
.LookIn = InputBox("Enter the string for folder selection.", "Search folder criteria.", "S:\Operations\Analysts\text files")
Response = MsgBox("Search subfolders ?", vbYesNo + vbDefaultButton1 + vbQuestion, "Subfolders ?")
If Response = vbYes Then
.SearchSubFolders = True
Else
.SearchSubFolders = False
End If
'.LastModified <= InputBox("Include files last modified on or before date:", "Search folder criteria.", Date - 60)
.Filename = "*" & InputBox("Enter the string for file selection.", "Search criteria.") & "*" '"*0407.*"

If .Execute > 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."

ListDeleteOrCancel.Show
'##this is a user form with buttons to list the files (varnow =1), ##
'##delete them varnow = 2) or cancel (3)##

If varnow = 1 Then 'list files
Workbooks.Add
For i = 1 To .FoundFiles.Count
ActiveCell.Value = .FoundFiles(i)

ActiveCell.Offset(1, 0).Select
Next i
ElseIf varnow = 2 Then
For i = 1 To .FoundFiles.Count
Kill .FoundFiles(i)
Next i
MsgBox "There were " & .FoundFiles.Count & " files deleted."
Else
Unload ListDeleteOrCancel
Exit Sub
End If
Else
MsgBox "There were no files found."
End If
End With

End Sub

For upcoming training course dates see: Pricing & availability

replyReplyThu 25 Feb 2010, 10:42Trainer Jacob said...

RE: Excel VBA

Hi Frazer

Thanks for your post and comprehensive detail, in these instances we can reach a solution for you but it is beyond the scope of the forum.

We would ask you to send us a copy of the files you are woring on with a guide list of areas to address. We will then get back to you with the scope of work and related costs, if you are happy to proceed we will then start work.

I shall email you direct so if you wish to progress this then please reply to me.

Kind regards

Jacob

Wed 3 Mar 2010: Automatically marked as resolved.

 

 

Please browse our web site to find out more about
ms excel training and other Microsoft training courses.

Excel tip:

Sum Up All the Values in A Column

If you want to quickly calculate the Summed values of all cells in a column in Excel 2003 normally you would use the SUM formula. (eg if you wanted to calculate the values in Column C rows 10 to 25) the formula would be:

=SUM(C10:C25)

However, if you keep adding values to column C you would keep having to modify the above SUM formula which can get quite annoying.

To get around this you can sum all the values in a column using the following formula:

=SUM(COLUMN:COLUMN)

Which, in our example, would be:

=SUM(C:C)

NOTE You cannot place this formula in column C, or else Excel 2003 will show a circular reference error.

The formula must be placed in any other column, EXCEPT the one being calculated.

View all Excel hints and tips


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training