Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Question 1
The code below does exactly what I want it to do when using it on the same sheet.
i.e. If a number greater than zero is entered into cell B5 on the current sheet (sheet1), the word “Red” will be entered into cell E7 on the current sheet (sheet1).
Does anyone know how to modify this so that “Red” is entered into cell E7 on sheet2 (same workbook)?Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Application.Intersect(Target, Range("B5")) Is Nothing Then
If Target.Value > 0 Then
Application.ActiveSheet.Range("E7") = "Red"
End If
End If
End SubQuestion 2
Is there a bit of code that would perform the same operation on numbers entered into any of three different cells or would three separate change events have to be set up to do this?
e.g.
If a number > 0 is entered into cell B5, enter the word “Red” into cell E7
If a number > 0 is entered into cell D6, enter the word “Blue” into cell E7
If a number > 0 is entered into cell E2, enter the word “Green” into cell E7Question 3
When I put two Worksheet_Change macros on the same sheet the following message appears when I try to run either one of them: “Compile error: Ambiguous name detected: Worksheet_Change”. But they both work fine when stored/run on their own. Is it not possible to have more than one Worksheet_Change event on one sheet?

taxi is right - you could do this very simply without code. If you INSIST on using code, then post back and its easily doable.
For your 3rd question, though:
Yes. It is NOT possible. Logically, it would be like having a light switch which turned a light bulb on and off simultaneously.
However, You can put the code from one into the other and then both will run consecutively.
Tom

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |