![]() |
Using worksheet_change to change value of target cell??
Is it possible to change the data within a cell based on what is
entered? Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Range("C16:F39"), Target) Then x = Target Range(Target.Address) = x + Range(F11) End If End Sub I tried using this but got a Run Time '1004' error. Basically, the user is inputing a number and I want to add a constant from another cell to this number for the output. I know I can do this with two tables or two sheets but I was hoping I could have it automatically update the same cell. Thanks, Mark |
Using worksheet_change to change value of target cell??
Alright, I got this to work with this code:
If Intersect(Range("b17:k40"), Target) Then If Target < 1 Then 'x = Target y = Range("h12").Value x = Target + y Range(Target.Address).Value = x Else Exit Sub End If End If but if I change a cell outside that range I get an error (Run-time error '91') Am I missing something with that intersect command? Thanks, Mark wrote: Is it possible to change the data within a cell based on what is entered? Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Range("C16:F39"), Target) Then x = Target Range(Target.Address) = x + Range(F11) End If End Sub I tried using this but got a Run Time '1004' error. Basically, the user is inputing a number and I want to add a constant from another cell to this number for the output. I know I can do this with two tables or two sheets but I was hoping I could have it automatically update the same cell. Thanks, Mark |
All times are GMT +1. The time now is 03:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com