Malcolm torishi
Board Regular
- Joined
- Apr 26, 2013
- Messages
- 219
[FONT="][FONT="]Hi[/FONT][/FONT]
[FONT="][FONT="]I have the below code that works when the users keeps entering a 1 under column B , say row 2, which then keeps adding 1 Under column C, say row 2. But it does not work if I have a vlookup in column B row 2. [/FONT][/FONT]
[FONT="][FONT="]Can anyone tell me how to make this code work when column B as a vlookup formula [/FONT][/FONT]
[FONT="][FONT="]Private Sub Worksheet_Change(ByVal Target As Range)[/FONT][/FONT]
[FONT="][FONT="][/FONT]
[/FONT]
[FONT="][FONT="][/FONT]
[/FONT]
[FONT="][FONT="]If Not Application.Intersect(Target, Columns(2)) Is Nothing Then[/FONT][/FONT]
[FONT="][FONT="] If Target = 1 Then Target.Offset(0, 1).Value = Target.Offset(0, 1).Value + 1[/FONT][/FONT]
[FONT="][FONT="]End If[/FONT][/FONT]
[FONT="][FONT="][/FONT]
[/FONT]
[FONT="][FONT="]End Sub[/FONT][/FONT]
[FONT="][FONT="][/FONT]
[/FONT]
[FONT="][FONT="]Thank you[/FONT][/FONT]
[FONT="][FONT="]I have the below code that works when the users keeps entering a 1 under column B , say row 2, which then keeps adding 1 Under column C, say row 2. But it does not work if I have a vlookup in column B row 2. [/FONT][/FONT]
[FONT="][FONT="]Can anyone tell me how to make this code work when column B as a vlookup formula [/FONT][/FONT]
[FONT="][FONT="]Private Sub Worksheet_Change(ByVal Target As Range)[/FONT][/FONT]
[FONT="][FONT="][/FONT]
[/FONT]
[FONT="][FONT="][/FONT]
[/FONT]
[FONT="][FONT="]If Not Application.Intersect(Target, Columns(2)) Is Nothing Then[/FONT][/FONT]
[FONT="][FONT="] If Target = 1 Then Target.Offset(0, 1).Value = Target.Offset(0, 1).Value + 1[/FONT][/FONT]
[FONT="][FONT="]End If[/FONT][/FONT]
[FONT="][FONT="][/FONT]
[/FONT]
[FONT="][FONT="]End Sub[/FONT][/FONT]
[FONT="][FONT="][/FONT]
[/FONT]
[FONT="][FONT="]Thank you[/FONT][/FONT]