Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50214

Applying code to specific cells when using worksheet_change?

$
0
0
New here and to VBA, but want code where result only applies to a range of cells . I have the following code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value = "" Then
Target.Formula = "=iferror(vlookup(A15:a18,$A$21:$B$24,2,),0)"
End If

End Sub

But i want it to apply to cells C14:C19 only. currently if any other cell is overwritten and deleted it returns this formula too.

I hope this makes sense!

David

Viewing all articles
Browse latest Browse all 50214

Trending Articles