Tuesday, March 29, 2016

Excel VBA code to Delete a Cell

Sub DeleteCell()
'
' DeleteCell Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
'
    sCurSheet = ActiveSheet.Name
    sCurCell = ActiveCell.Address
    sCurVal = ActiveCell
    bScreenUpdating = Application.ScreenUpdating
    Application.ScreenUpdating = False
    Logit "@deleted '" & sCurVal & "' from " & sCurCell
    Range("Backup_data") = sCurVal
    
    Selection.Delete Shift:=xlUp '  1004         Cannot use that command on overlapping selections.
    Application.ScreenUpdating = bScreenUpdating
End Sub


No comments:

Post a Comment