How to write vba macro in excel 2013 to delete cells in column

Closed
waisi
Posts
1
Registration date
Sunday October 12, 2014
Status
Member
Last seen
October 12, 2014
- Oct 12, 2014 at 08:50 PM
TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
- Oct 13, 2014 at 11:53 AM
I am analyzing data of two column A1-A310632 cell and B1-B310632 cells to check and delete the first 2 columns i.e A1-2,B1-B2 while keeping the next column ie A3,B3 and again deleting the next 2 columns ie A4- A5,B4,B5 keeping 1 column ie A6and B6 until reach A310632 and B310632.

For example
A1,B1.......macro to delete
A2,B2.......macro to delete
A3,B3.......macro to skip DONOT DELETE
A4,B4......macro to delete
A5,B5.......macro to delete
A6,B6.......macro to skip DONOT DELETE
.
.
.
A310632,B310632



Thank you and appreciate if I can be given VBA macro code examples

regards

1 reply

TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
510
Oct 13, 2014 at 11:53 AM
Hi Waisi,

See if the following code yields the desired result:
Sub RunMe()
Dim x As Long
x = 1

Do
    Range(Cells(x, "A"), Cells(x + 1, "A")).EntireRow.Delete
    x = x + 1
Loop Until IsEmpty(Range("A" & x))

End Sub


Best regards,
Trowa
0