why wont these two codes work together

Colleen45

Active Member
Joined
Jul 22, 2007
Messages
495
These two codes work fine individually, but together (as they are below)I can't get them to work together, and I can't figure out why.

Code:
Option Explicit
Rem If cell = "yes" move cursor focus to selected cell
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub ' only one cell changes
If Not Intersect(Target, Range("E191,E197,E202,E212,F231,F233,F235,F251,F254,F260")) Is Nothing Then
    If LCase(Target.Value) = "yes" Then
        Application.EnableEvents = False
        Select Case Target.Address(0, 0)
            Case "E191": Range("G187").Select
            Case "E197": Range("G193").Select
            Case "E202": Range("G200").Select
            Case "E212": Range("G205").Select
            Case "F231": Range("I230").Select
            Case "F233": Range("I232").Select
            Case "F235": Range("I234").Select
            Case "F251": Range("H247").Select
            Case "F254": Range("H247").Select
            Case "F260": Range("H257").Select
        End Select
        Application.EnableEvents = True
    End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  With ActiveSheet.Shapes("Rectangle 1")
    .Left = Target.Left
    .Top = Target.Top
    .Width = Target.Width
    .Height = Target.Height
  End With
  Target.Activate
End Sub
 
Last edited:
YAAAAAAAAAY
That works perfectly, I'm so very happy
Rory, really, thank you for the time and trouble you have put into helping me, GREAT WORK
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Nice one Rory
I didn't even pick up on the EnablerEvents line......:oops:.......the merged cells wouldn't have helped the cause either ...(y)
 
Upvote 0

Forum statistics

Threads
1,215,836
Messages
6,127,183
Members
449,368
Latest member
JayHo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top