Select Case
The code works great except it removes a calculation for finding hours worked:
=IF(COUNT(B8:C8)=2,(C8-B8)*24-0.5,0)
Can the line after Case Else MsgBox "Not A, H, or V." be replaced with this
formula so that the calculation will take place if A, H, or V are not
selected?
Thanks!
"Jim Thomlinson" wrote:
Sure if you want the code to work you can do that but I thought that this was
much more inventive... ;-) Thanks for catching that one...
--
HTH...
Jim Thomlinson
"Dave Peterson" wrote:
I think that this:
If not intersect (Target.Column, Range("B2:B100") is nothing Then
should be:
If not intersect (Target, Range("B2:B100")) is nothing Then
Target.column will return a number (and a typo missing that final close
parenthesis).
Jim Thomlinson wrote:
here it is for changed made to B2 through B100, updating column D... This
should be a bit closer...
Private Sub Worksheet_Change(ByVal Target As Range)
If not intersect (Target.Column, Range("B2:B100") is nothing Then
Select Case UCase(Target.Value)
Case "A", "H", "V"
Target.Offset(0, 2).Value = 8
Case Else
MsgBox "Not A, H or V."
End Select
End If
End Sub
--
HTH...
Jim Thomlinson
"MikeG" wrote:
Can this be edited so that the Target is a range of cells rather than a column?
"Jim Thomlinson" wrote:
Your description is a little thin. Here is some event code that responds to
changes in column A and places a value beside the cell that was changed.
Right click the sheet tab and select view code. Paste the following...
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
Select Case UCase(Target.Value)
Case "A", "H", "V"
Target.Offset(0, 1).Value = 8
Case Else
MsgBox "Not A, H or V."
End Select
End If
End Sub
--
HTH...
Jim Thomlinson
"MikeG" wrote:
I would like to be able to enter the letters "V", "H" or "A" into a cell and
have the number 8 entered into another cell. How can this be done using
Select Case?
--
Dave Peterson
|