LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default conflict in code somewhere

Hi,
The following code works in a Worksheet_Change (ByVal Target As Range) event:

' Displays message box when "C" is selected in H
Dim Res3 As VbMsgBoxResult
If Not Intersect(Target, Me.Range("H4:H4000")) Is Nothing Then
With Target
If Target.Value = "C" Then
If Target.Offset(, -1) = "" Then
Application.EnableEvents = False
Res3 = MsgBox("No account has been selected!", vbOKOnly, "Charging of
accounts")
Target.Value = vbNullString
Else
Res3 = MsgBox("Is this item to be charged to an account?", vbYesNo,
"Charging of accounts")
If Res3 = vbNo Then
Target.Value = vbNullString
Else
UserForm7.Show
End If
Application.EnableEvents = True
End If
End If

When another function is added to the same Worksheet_Change code, the second
one (below) doesn't work.

However, if the first one is removed, it works fine:

' when date entered in "K", checks "H"
Dim Res4 As VbMsgBoxResult
Const Myrange3 = "K4:K4000"
If Not Intersect(Target, Me.Range("K4:K4000")) Is Nothing Then
Exit Sub
End If
If IsDate(Target) And Target.Offset(, -3) = "" Or Target.Offset(, -3)
= "N" Then
Application.EnableEvents = False
Res4 = MsgBox("Cannot issue claim without payment!")
Target.ClearContents
Application.EnableEvents = True
End If


The first code above is currently at the end of about 4 pages of other code
in Sheet!1 all of which works ok until the second one is added.
I have three other subs to add but until I can figure out why they don't
work, when added in, I am stuck.


Can I have a second Worksheet_Change event to put these into or can they be
placed in ThisWorkbook or in a module?
Help!
Thanks in advance.
--
Traa Dy Liooar

Jock
 
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
Name Conflict Roger[_4_] Excel Discussion (Misc queries) 2 March 15th 08 01:13 AM
Name Conflict Roger[_4_] Excel Discussion (Misc queries) 5 March 14th 08 02:14 PM
conflict with code Curt Excel Programming 7 March 17th 07 12:25 PM
Conflict Don Lloyd Excel Programming 2 October 11th 03 11:44 PM
Name conflict John Turton Excel Programming 2 August 28th 03 04:47 PM


All times are GMT +1. The time now is 05:31 PM.

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

About Us

"It's about Microsoft Excel"