#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 213
Default Code Help

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!

--
Randy Street
Rancho Cucamonga, CA
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Code Help

Check your other post.

Randy wrote:

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!

--
Randy Street
Rancho Cucamonga, CA


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
Unprotect Code Module in Code Damien Excel Discussion (Misc queries) 2 April 18th 06 03:10 PM
Need 2 add second then third code with first code in the Tab View nick s Excel Worksheet Functions 3 December 6th 05 02:20 AM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
Write a code by code Excel Discussion (Misc queries) 1 March 23rd 05 02:34 PM


All times are GMT +1. The time now is 08:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"