Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / June 2005

Tip: Looking for answers? Try searching our database.

Beginners Macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cofi Sais - 24 Jun 2005 12:42 GMT
A relative novice with Excel, I use a number of worksheets for recording
amongst other things, when various items of plant and equipment are due for
test and inspection. As an initial experiment (I need to expand it in due
course to do more complicated filters) I have recorded a macro to filter out
items due for test within given dates and print out the result using the
AutoFilter function. Sample data below:

DESCRIPTION        DATE LAST SEEN
Yale Lever Hoist        05/08/04
Yale Lever Hoist        05/08/04
Yale Lever Hoist        06/08/04
Winch Rope        03/02/05

The macro is as follows:

Sub Sort()
'
' Sort Macro
' Macro recorded 23/06/2005 by Tony
'
' Keyboard Shortcut: Ctrl+s
'
   Range("G4").Select
   Selection.AutoFilter
   Selection.AutoFilter Field:=7, Criteria1:=">=23/06/2005",
Operator:=xlAnd _
       , Criteria2:="<=05/08/2005"
   ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
   ActiveSheet.ShowAllData
   Selection.AutoFilter
End Sub

The first time I run the macro it works fine, however if I try to run it a
second time it only prints out the coloumn headings.

I am sure the solution is obvious, but not to me. Can anyone please point me
in the right direction. In the longer term I would like to have “selection”
boxes where I am prompted for the “from” and “to” dates.

Thanks in advance

Signature

Tony

Kassie - 27 Jun 2005 15:39 GMT
Hi Cofi
You need to undo your filter, before you can run it again.  You are now
filtering an already filtered selection.

> A relative novice with Excel, I use a number of worksheets for recording
> amongst other things, when various items of plant and equipment are due for
[quoted text clipped - 36 lines]
>
> Thanks in advance
Cofi Sais - 28 Jun 2005 06:48 GMT
Kassie
Have tried that but still have the same problem.Even tried recording another
macro to undo the filter!
Thanks for your response.Any other ideas?
Signature

Tony

> Hi Cofi
> You need to undo your filter, before you can run it again.  You are now
[quoted text clipped - 40 lines]
> >
> > Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.