Excel Macro Help to delete first cell

Closed
Karthik - Sep 23, 2010 at 05:31 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Sep 23, 2010 at 11:28 PM
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 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Sep 23, 2010 at 11:28 PM
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