Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How hard is it to do this?

Status
Not open for further replies.

Sheltered

Programmer
Nov 26, 2002
55
0
0
GB
Hi, not sure how difficult this is as im no expert on Excel.
I have 2 spreadsheets one with details of holidays, ie start date, end date, number of hours taken etc, and another spreadsheet set up as a rota with all dates across the top and staff down the left side.
What i want is to be able to enter a date in the holiday spreadsheet and have the corresponding date on the rota spreadsheet change to a 'H' and turn blue.

ie. i enter 09/12/2003 as a holiday and the cell in the rota spreadsheet changes as below, but colour aswell.


BEFORE:
* |09/12/2003|10/12/2003|
PB| D | D |

AFTER:
* |09/12/2003|10/12/2003|
PB| H | D |


Hope that makes sense. Any ideas where to start with this?

Thanks very much

Pete
 
In the Worksheet_Change() event, you could add code to store the entered date:
Code:
Dim dtHoliday as Date
dtHoliday=ActiveCell.value
open the rota workbook:
Code:
Workbooks.Open "rota.xls"
find the associated date entered
Code:
Set fndFind = .Find(dtHoliday)
If fndFind Is Nothing Then
MsgBox "Date Not found"
Else
Range("").Value="H"
Range("").Font.ColorIndex=(blue)

The Range("") entry would be set to select the cells you want to add the blue H to. If you want to do it for all personnel, the enter that whole range.

You could do the above on a button (click the button with the holiday date cell active) or set the Application.MoveAfterReturn to false so that the active cell doesn't change after entering the date. I'd probably put it on a button to eliminate any possible problems with other cell changes.

Hope that helps.


DreamerZ
simplesolutions@prodigy.net
[ignore][/ignore]
 
Hi,

1. The color can be formatted using Format/Conditional Formatting using this formula as Formula Is
Code:
=MATCH(B$1,Holidays,0)>0
where the range of holiday dates has been given a Range Name of Holidays.

2. Use this forumla to change the Value in the cells
Code:
=IF(ISERROR(MATCH(B$1,Holidays,0)>0),"D","H")
:)

Skip,
 
Thanks guys, seems straight forward enough. ill have a play around and see what i can do.

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top