O
okrob
Why can't I use this:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range("Data").Rows.Count < Sheet6.Cells(1, 199).Value Then
Dim x
x = Target.Row
Sheet6.Cells(1, 200).Value = Sheet6.Cells(1, 200).Value & " / " & x
Sheet6.Select
Cells(x, 1).Select' <== This line causes
' a "Select Method of Range Class Failed" error
Selection.EntireRow.Delete
End If
Sheet6.Cells(1, 199).Value = Range("Data").Rows.Count
End Sub
What I'm doing is looking at the sheet that the event is fired from,
getting the target range, determining if a row was deleted, then I
want to go to sheet6 and delete the corresponding row. When
debugging, x = the row that I deleted, but I can't seem to select the
same row on the other sheet...
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range("Data").Rows.Count < Sheet6.Cells(1, 199).Value Then
Dim x
x = Target.Row
Sheet6.Cells(1, 200).Value = Sheet6.Cells(1, 200).Value & " / " & x
Sheet6.Select
Cells(x, 1).Select' <== This line causes
' a "Select Method of Range Class Failed" error
Selection.EntireRow.Delete
End If
Sheet6.Cells(1, 199).Value = Range("Data").Rows.Count
End Sub
What I'm doing is looking at the sheet that the event is fired from,
getting the target range, determining if a row was deleted, then I
want to go to sheet6 and delete the corresponding row. When
debugging, x = the row that I deleted, but I can't seem to select the
same row on the other sheet...