Hi,
I'm looking for some assistance with the following macros which are causing a conflict when active in the same workbook.
I have a module which contains 4 macros similiar to MoveActiveRowtoCommenced(), which allow the user to move selected rows back and forth across 3 worksheets. These have been working fine until I recently added code to timestamp usernames and times for changed (with the code contained under the specific worksheet), and although the two don't directly relate to each other I'm now getting a 'Delete Method of Range Class Failed' when trying to move rows using any of the 4 contained in the module.
Any pointers on why this is now happening would be much appreciated!
Thanks
David
Sub Worksheet_Change(ByVal Target As Range)
Dim x As Range
Dim yourdate As String
yourdate = Format(Now, "mmm-dd-yyyy hh:mm:ss am/pm") 'Format Today() as specified
If Target.Column <= 21 Then
Worksheets("Outstanding").Unprotect Password:="Password1"
''Cells(ActiveCell.Row, "U").Select
Cells(ActiveCell.Row, "V").Value = Environ("USERNAME")
Cells(ActiveCell.Row, "W").Value = yourdate
Worksheets("Outstanding").Columns("V:W").AutoFit
Worksheets("Outstanding").Protect Password:="Password1"
End If
End Sub
Sub MoveActiveRowtoCommenced()
Worksheets("Outstanding").Unprotect Password:="Password1"
Worksheets("Commenced").Unprotect Password:="Password1"
Application.ScreenUpdating = False
Dim strSheetName, strCellAddress As String
strSheetName = ActiveSheet.Name
strCellAddress = ActiveCell.Address(False, False)
Rows(ActiveCell.Row).Cut
Sheets("Commenced").Select 'Change sheet name to whatever consolidated tab name is.
'Range("A" & Range("A65536").End(xlUp).Row.(Offset(1, 0).Select
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A" & ActiveCell.Row).Select
Sheets(strSheetName).Select
Range(strCellAddress).Select
Rows(ActiveCell.Row).Delete
Application.ScreenUpdating = True
Worksheets("Commenced").Protect Password:="Password1"
Worksheets("Outstanding").Protect Password:="Password1"
End Sub
Bookmarks