View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
KevHardy KevHardy is offline
external usenet poster
 
Posts: 39
Default Some macros not working on shared workbook

Hi all,
I'm sharing a workbook but one of the macros isn't working:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Const WS_RANGE As String = "J:J"
Dim rng1 As Range
Dim rng2 As Range

If Target.Cells.Count 1 Then
Exit Sub
End If

If Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Exit Sub
End If

Set rng1 = Target.EntireRow.Range("A1:J1")

With Worksheets("outcomes")
Set rng2 = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0)
End With

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Value < "" Then
With rng1
..Copy _
Destination:=rng2
..Delete Shift:=xlUp
End With
End If
ws_exit:
Application.EnableEvents = True

End Sub

This one copy/deletes a defined row of data to another sheet when J:J
changes (it has a validation list of blank or yes).
I have a few other macros in the workbook such as opening at a specific
sheet, highlighting selected rows, two useforms adding data to the next
available empty row etc and these all work fine.

Any ideas why the one above doesn't?