Worksheet_Change event
Closed
cptn
-
Nov 29, 2015 at 06:08 AM
RayH Posts 122 Registration date Tuesday August 31, 2010 Status Contributor Last seen June 20, 2016 - Dec 1, 2015 at 01:02 PM
RayH Posts 122 Registration date Tuesday August 31, 2010 Status Contributor Last seen June 20, 2016 - Dec 1, 2015 at 01:02 PM
Related:
- Worksheet_Change event
- Fortnite christmas event - Guide
- Acnh halloween event - Guide
- Apple event october 2023 - Guide
- Apple event september 2023 - Guide
- Fortnite halloween event - Guide
Dec 1, 2015 at 10:57 AM
Dec 1, 2015 at 11:20 AM
Also, the addition does work too. See lines 6 to 8.
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("C1")) Is Nothing Then Exit Sub End If If Range("C1") = "oh" Then Range("B1") = Range("B1") + Range("A1") End If End SubDec 1, 2015 at 11:29 AM
Dec 1, 2015 at 11:48 AM
Private Sub Worksheet_Changr(ByVal Target As Excel.Range)
With Target
If .Address(False,False) = "A1" Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("C1").Value = Range("C1").Value +.Value
Application.EnableEvents = True
End If
End If
End With
End Sub
/Code
In cell B2 I have OH
I dont want cell C1 to calculate unless B2 = OH
Ive tried to include B2 as a range with IsText and declaring it .Text, have tried your way(even though cell locations re different)
Dec 1, 2015 at 12:11 PM
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub End If If IsNumeric(Range("A1")) And Range("B2") = "OH" Then Range("C1") = Range("C1") + Range("A1") End If End SubThis checks for changes to values in cell A1.
then if A1 is numeric AND B2 =OH then add A1 to C1