How to use Target in Worksheet_Change?

Karlbirger

Board Regular
Joined
Sep 21, 2011
Messages
68
Hi guys,

I've been trying to configure my formula in Worksheet_Change to only run when targeted cells are being changed (by using Target). I don't get it to work properly.

A cell value is supposed to change in column AK when the equivalent cell in column H is changed.
Please se my formula below.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = "H" Then
Dim LastRow As Long
Dim Cell As Range
LastRow = Range("H" & Rows.Count).End(xlUp).Row
For Each Cell In Range("H6:H" & LastRow)
    If Cell.Value = "Yes" Then
        Range("AK" & Cell.Row).Value = "1.00"
    Else
    End If
Next Cell
End If

End Sub


Anyone used to work with Worksheet_Change Target who can see how I use Target wrong?

Regards
KB
 
VoG: thanks for your reply. The option with "Case" is new to me.

Thanks to both of you VoG and wigi. As always very friendly and helpful in this forum, don't know what I would do without the help that is being distributed here.

Regards
KB
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,214,805
Messages
6,121,656
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top