Code Help

R

Randy

Looking to modify a code I have that put an "X" into a particular cell no
matter what the user types. Code work great! However, I need to modify the
code so that If an "X" is types into cell "B8", cell "F8" returns a null
value (or deletes any value in the cell)....but wait, that's not all...I also
need it to do the reverse....If user types an "X" into "F8" it should delete
any value in cell "B8"....kind of tricky I know...here is the code I have so
far:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sINPUTS As String = "B8,B10,B12,B15,F8,F10,F12,F15"
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range(sINPUTS), .Cells) Is Nothing Then
If Not IsEmpty(.Value) Then
On Error Resume Next
Application.EnableEvents = False
.Value = "X"
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End With
End Sub

If anyone knows how or can assist in any way I would be forever grateful!
Thanks in advance for any assistance!
 
D

Dave Peterson

Check your other post.
Looking to modify a code I have that put an "X" into a particular cell no
matter what the user types. Code work great! However, I need to modify the
code so that If an "X" is types into cell "B8", cell "F8" returns a null
value (or deletes any value in the cell)....but wait, that's not all...I also
need it to do the reverse....If user types an "X" into "F8" it should delete
any value in cell "B8"....kind of tricky I know...here is the code I have so
far:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const sINPUTS As String = "B8,B10,B12,B15,F8,F10,F12,F15"
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range(sINPUTS), .Cells) Is Nothing Then
If Not IsEmpty(.Value) Then
On Error Resume Next
Application.EnableEvents = False
.Value = "X"
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End With
End Sub

If anyone knows how or can assist in any way I would be forever grateful!
Thanks in advance for any assistance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

VBA Coding Help for Beginner 0
Code Modification 2
Modify code 2
Help with Code 3
Cell Protection 1
Date Stamp with protection 6
Cell Auto Code 1
Need help modifying code 0

Top