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, 2023 in Others by Kithuzzz
• 38,000 points
393 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, 2023 by narikkadan
• 63,600 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,710 points
1,126 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,210 points
750 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,460 points
2,080 views
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
1,212 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
3,663 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
• 23,260 points
908 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,690 points
1,053 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, 2023 in Others by narikkadan
• 63,600 points
2,230 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