Help making macro finds last used line + push down and delete !
Closed
Karina-Brazil
Posts
1
Registration date
Thursday November 13, 2014
Status
Member
Last seen
November 13, 2014
-
Nov 13, 2014 at 06:28 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 15, 2014 at 01:55 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 15, 2014 at 01:55 AM
Related:
- Help making macro finds last used line + push down and delete !
- Push video wallpaper - Download - Customization
- Steam push to talk - Guide
- Delete my whatsapp account without app - Guide
- How to delete whatsapp account without phone - Guide
- Delete snapchat account permanently - Guide
1 response
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Nov 15, 2014 at 01:55 AM
Nov 15, 2014 at 01:55 AM
you should have given a small extract of your data. see the saample data below in sheet1. as you are messing up with data copy sheet1 to shee2 before using the macro . the macro is given below. invoke only "test"
1 x x x x x x x x x
2 x x x x x x x x x
3 x x x x x x x x x
4 x x x x x x x x x
5 x c x e x x x i j
1 x x x x x x x x x
2 x x x x x x x x x
3 x x x x x x x x x
4 x x x x x x x x x
5 x c x e x x x i j
Sub test()
Dim lastrow As Long, r(1 To 4), j As Long
undo
Worksheets("sheet1").Activate
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Cells(lastrow, 1).EntireRow.Insert shift:=xlDown
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set r(1) = Cells(lastrow, "I")
Set r(2) = Cells(lastrow, "J")
Set r(3) = Cells(lastrow, "E")
Set r(4) = Cells(lastrow, "C")
For j = 1 To 4
r(j).Clear
Next j
MsgBox "macro done"
End Sub
Sub undo()
Worksheets("sheet1").Cells.Clear
Worksheets("sheet2").Cells.Copy Worksheets("sheet1").Range("a1")
End Sub