Need help to delete rows in VBA

0 votes

If the rows are not going 2,1,2,1,2,1, I want to develop a piece of code that will check column L and delete the row if the subsequent row does not include a 1.

enter image description here

I am fairly green with VBA so just finding similar codes and trying to tweak but to no avail.

Jan 13 in Others by Kithuzzz
• 28,700 points
35 views

1 answer to this question.

0 votes

Here is a basic macro that deletes rows.

Sub Delete_Rows()
Dim Wsht as Worksheet: Set Wsht = ActiveSheet
Dim RowNum as Long

With Wsht
For RowNum = .UsedRange.Rows.Count to 1 Step -1
   If .Cells(RowNum, 1) = 1 Then .Rows(RowNum).Delete
Next
End With

End Sub
answered Jan 13 by narikkadan
• 53,160 points

Related Questions In Others

0 votes
1 answer

How to delete duplicate rows in SQL Server?

To answer your query, note that CTEs ...READ MORE

answered Feb 10, 2022 in Others by Soham
• 9,700 points
372 views
0 votes
1 answer

How to delete duplicate rows in SQL Server?

WITH CTE AS ( SELECT *,ROW_NUMBER() OVER (PARTITION BY ...READ MORE

answered Jun 21, 2022 in Others by nisha
• 2,190 points
98 views
0 votes
1 answer

ERROR: You need elevated Administrator privileges in order to run this script.

Hi@akhtar, I guess you are trying to run ...READ MORE

answered Sep 8, 2020 in Others by MD
• 95,420 points
874 views
0 votes
2 answers
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
529 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
2,408 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 22,940 points
117 views
0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,630 points
294 views
0 votes
1 answer

Delete all rows in filtered range Except first filtered row in excel VBA

Use a flag to omit first row Sub ...READ MORE

answered Jan 8 in Others by narikkadan
• 53,160 points
70 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP