Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kevin,
You can use the worksheet's change event. Copy the code below, right click on the sheet tab and select "View Code" and paste the code into the window that appears. Then anytime you enter "Holiday" (without the quotes) into cells G7:G12, your values will be auto-entered in columns D, E, and F of the same row. HTH, Bernie MS Excel MVP Private Sub Worksheet_Change(ByVal Target As Range) Dim myCell As Range If Not Intersect(Target, Range("G7:G12")) Is Nothing Then Application.EnableEvents = False For Each myCell In Intersect(Target, Range("G7:G12")) If myCell.Value = "Holiday" Then Cells(myCell.Row, 4).Value = "09:00:00" Cells(myCell.Row, 5).Value = 1# Cells(myCell.Row, 6).Value = "17:00:00" End If Next myCell Application.EnableEvents = True End If End Sub "Kevin" ! wrote in message ... I really need some help with this problem I have a Time sheet with a row G7:G:12 that contains Data Validation List. In this list I have one of many values named Holiday, what I like to do is when you select this value "holiday" form the drop down list in cell G7 it would automatically trigger a macro to add 9:00 am to cell D7, 1.0 to cell E7 and 5:00 pm to cell F7. It should work the same for the rest of the other rows from G8:G12. I would actually would like just to paste a value of 7.00 to cell I7 where "Hours Worked" are but the formula would be deleted, and the sheet will not be useful. A nother idea that I had was to validate the cells G7:G:12 so a message would appear when the word "holiday" was chosen, but those cells already have data validation to create the list, so no luck there. I been looking in here in the excel newsreader and in goggle for similar code so I could tweak it, but I do not understand enough VB to find similar code out there that I could alter. Thanks again for all your help, and hope I haven't been to much trouble this last month asking for help in the forum, you guys are great help. Any ideas are welcome Kevin Brenner |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro - specific range | Excel Discussion (Misc queries) | |||
How do I get a function to execute on a specific date in Excel? | Excel Worksheet Functions | |||
How to run specific macro on selected worksheet? | Excel Discussion (Misc queries) | |||
Identifying a Selected Range in a Macro | Excel Discussion (Misc queries) | |||
Macro to print a selected range, not entire worksheet | Excel Discussion (Misc queries) |