This is the first time I've really tried to use VBA in excel.
I'm trying to get a cell's value (K6) to change to another cell's value (B2) whenever P6 is equal to 1. As far as I can tell I have formatted things correctly but whenever P6 changes to 1 in my worksheet, K6 does not change at all. What am I doing wrong? My code is below...
Thank you!
I'm trying to get a cell's value (K6) to change to another cell's value (B2) whenever P6 is equal to 1. As far as I can tell I have formatted things correctly but whenever P6 changes to 1 in my worksheet, K6 does not change at all. What am I doing wrong? My code is below...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("P6") Then
If Sheets("Sheet1").Range("P6").Value = 1 Then
Sheets("Sheet1").Range("K6").Value = Sheets("Data").Range("B2").Value
End If
End If
End Sub
Thank you!