• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1029
  • Last Modified:

Staff Holiday Record Macro

On the attached .xls I would like to build a macro which shows me on sheet 2, 6 months in advance who will be off, but necer show previous dates.  The columns in sheet 2 should show the following:

1.  Date = 1-999 which dates are coming up first at the top.
2.  Day = Monday/Tuesday etc.
3.  Time off should pull the data from sheet 1 to show how long they are off for i.e. 1 day .5 day etc.
4.  The staff names = Just put the word 'Yes' in the row under the member of staff it corresponds to.

Any help is greatly appreciated.
Holiday-Chart-2008-to-2009.xls
0
Simonrepro
Asked:
Simonrepro
  • 5
  • 5
1 Solution
 
purplepomegraniteCommented:
The attached file works as you have requested.  To update the summary sheet, just run the macro CreateSummaryForecast.

I would have added a button to click to be able to do this... but embarrassingly I still haven't worked out how to add buttons to worksheets using Excel 2007...
Holiday-Chart-2008-to-2009.xls
0
 
Jaffa0Commented:
Go to Excel options and enable 'Show Developer tab in Ribbon' no the Popular page. You can add controls from there.
0
 
SimonreproAuthor Commented:
This is great just one problem, the line below is in yellow?

ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Clear
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
SimonreproAuthor Commented:
Also only need to see dates after current date i.e. today I would not expect to see anything from before 20/06/08
0
 
SimonreproAuthor Commented:
I can't find a button called 'Options'
0
 
purplepomegraniteCommented:
Oh, yes, forgot about current date.  Will adjust.

Jaffa0's comment was to me, I think, re. Excel 2007.  Will try that... thanks!!
0
 
purplepomegraniteCommented:
The ribbon thing worked great - thanks Jaffa0, I've been wondering about that for ages!  Though I did still forget to add the button, I've just realised.

Amended code attached that only shows dates yet to occur.

If the line is in yellow, you are in break mode for some reason.  Did you receive an error or something?  Shouldn't be in break mode unless you press <CTRL><BREAK>
Holiday-Chart-2008-to-2009.xls
0
 
purplepomegraniteCommented:
The attached has a button on the first sheet for convenience.
Holiday-Chart-2008-to-2009.xls
0
 
SimonreproAuthor Commented:
ActiveWorkbook.Worksheets("Sheet2").Sort.SortFields.Clear

When I click create summary it says run time error 438 the object does not support this property or method and
The above line is still in yellow
0
 
purplepomegraniteCommented:
Ok, I've amended the sort code.  There were changes made to VBA with regards to the sort between earlier versions of Excel and 2007.  I have rewritten it so that it should be compatible now.
Holiday-Chart-2008-to-2009.xls
0
 
SimonreproAuthor Commented:
That's great many thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now