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,010 points
248 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,420 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
897 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
489 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,440 points
1,671 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
902 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,222 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
514 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,670 points
756 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,420 points
1,510 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