Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Macro on a data validation list

I have a Time sheet with a row G7:G:12 that contains Data Validation List.
In this list I have a value 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 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.
I tried recording a macro but of course that was to specific to that
recorded row and would not work with other rows.
What I need is some guiding where to find a similar code that can be alter
to fit my needs. Been looking in google but really don't know what keywords
to search for.

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.

Kevin Brenner


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Macro on a data validation list

Kevin

Try this Worksheet_Change event code. I put comments in it, but post back
if you have questions.

Private Sub Worksheet_Change(ByVal Target As Range)

'Make sure changed cell is in G7:G12
If Not Intersect(Target, Me.Range("G7:G12")) Is Nothing Then

'With column I on same row
With Me.Range("I" & Target.Row)

'If holiday selected
If Target.Value = "Holiday" Then

'Add +7 to the formula
.Formula = .Formula & "+7"

'If holiday not selected
Else

'If formula already has a +7 then remove it
If Right(.Formula, 2) = "+7" Then
.Formula = Left(.Formula, Len(.Formula) - 2)
End If
End If
End With
End If

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Kevin" ! wrote in message
...
I have a Time sheet with a row G7:G:12 that contains Data Validation

List.
In this list I have a value 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 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.
I tried recording a macro but of course that was to specific to that
recorded row and would not work with other rows.
What I need is some guiding where to find a similar code that can be alter
to fit my needs. Been looking in google but really don't know what

keywords
to search for.

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.

Kevin Brenner




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Validation - List - Setting Range from a macro dhstein Excel Discussion (Misc queries) 5 May 14th 09 01:11 PM
Data Validation List Macro Lisa C. Excel Discussion (Misc queries) 18 April 6th 09 12:53 PM
data validation list: how do i 'force' a user to enter data from the list? showsomeidnow Excel Discussion (Misc queries) 4 May 1st 07 05:49 PM
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM


All times are GMT +1. The time now is 02:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"