Excel Macro Help to delete first cell

Closed
Report
-
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
-
Hello,

i required a macro coding to delete the first cell in the column.

Eg: if i enter any value in cell C11 then automatically the Cell C1 value will be deleted and then replaced by the below cell values (like C1 = C2, C2=C3 & Etc).

Can anyone of you help me. Thanks

Regards
Karthik

1 reply

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
804
Karthik
you need an event code which is a macro but which will be automatically activated if an event occurs.

BEFORE DOING THIS AS YOU ARE MESSING UP WITH DATA KEEP THE ORIGINAL DATA SAFELY SOMEWHERE


right click the sheet tab and click view code. in the window that comes up copy this event code. do this on an experimental sheet firt.


Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range, c As Range
If Target.Address <> "$C$11" Then Exit Sub
Set r = Range("c1:c10")
For Each c In r
c = c.Offset(1, 0)
Next c

End Sub
0