View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Eric White[_2_] Eric White[_2_] is offline
external usenet poster
 
Posts: 45
Default Insert value in cell if another cell contains specified value

You could use an IF formula in B and C, e.g.,
=IF($A2="Priv","-",OriginalValueOrFormula), or

Worksheet_Change(ByVal Target As Range)

if Target.Column = 1 And Target.Value = "Priv" Then
Range(Cells(Target.Row, 2), Cells(Target.Row, 3)).Value = "-"
Else
'Whatever original value or formulae for B and C
End If

End Sub




"Mikus" wrote:

I need macro that would enter certain text value in specified cells if
certain value is entered in another cell.

For example i have following worksheet

A B C D
1 Biz xxx yyy zzz
2
3

I need macro that would enter "-" in column B and C if value "Priv" is
entered in column A (I select values from dropdown that is specified for
column A).
Macro should trigger when i select value "Priv" from column A cell.

In this case if i would select cell A2 and then choose value "Priv" then
value "-"should automaticaly be inserted in cell B2 and cell C2 and cursor
should stop on cell D2 (the active cell after macro runs should be D column
cell)

This should be applied for all cells in columns A,B,C,D

Any ideas ?