Active cell deleting and shifting up

kamranyd

Board Regular
Joined
Apr 24, 2018
Messages
152
Office Version
  1. 2021
Platform
  1. Windows
HI, can anyone help me, I am using this code for deleting active cell and shift up, can we write these code more short or any other way.

VBA Code:
Sub Delete_Range_To_ShiftUP()
    ActiveCell.Delete
    ActiveCell.Offset(0, 1).Delete
    ActiveCell.Offset(0, 2).Delete   
End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
VBA Code:
ActiveCell.Resize(1, 3).Delete (xlShiftUp)
 
Upvote 1
Solution
Post 2 line of code delete cells and shift up. how about if I want to add cell in-between cells and copy upper cells formula.
 
Upvote 0
these codes add entire row whatever cell I select plus copy above formula and formats. I want to add three cells wherever I want in sheet not entire row.

VBA Code:
Sub add_row_list_Click()
    Sheets("lists").Unprotect
    ActiveCell.Offset(1).EntireRow.Insert
    ActiveCell.EntireRow.Copy ActiveCell.Offset(1).EntireRow
    On Error Resume Next
    ActiveCell.Offset(1).EntireColumn.SpecialCells(xlConstants).ClearContents
    ActiveCell.Offset(1, 0).Select
    Application.CutCopyMode = False
    Sheets("lists").Protect AllowFormattingCells:=True, AllowFiltering:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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