Remove line if x, add line if y

jalrs

Active Member
Joined
Apr 6, 2022
Messages
300
Office Version
  1. 365
Platform
  1. Windows
Good morning guys,

I would like to delete the entire row if my column M cells are equal to 0,000, starting on row 2.
I would also like to add a new line, immediately under the one where the condition is met, if my column K cells are greater than the matching column L cells.

My code is as follows:
VBA Code:
Sub play()

Dim livro1 As Workbook
Dim folha1 As Worksheet
Dim folha2 As Worksheet
Dim ultimalinha1 As Long

Set livro1 = ThisWorkbook
Set folha1 = livro1.Worksheets("ZPO1")
Set folha2 = livro1.Worksheets("Play")

ultimalinha1 = folha1.Cells(Rows.Count, "A").End(xlUp).Row

folha2.UsedRange.Offset(1).Cells.ClearContents

    With folha1
    
        .Range("A2:O" & ultimalinha1).Copy
        folha2.Cells(2, 1).PasteSpecial Paste:=xlPasteFormats
        folha2.Cells(2, 1).PasteSpecial Paste:=xlPasteValues
    
    End With
    
Application.CutCopyMode = False

folha2.Activate

folha2.Range("A2").Select
    
End Sub

Any help is greatly appreciated.

Thanks!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Upping this for the other side of the world.

Thanks
 
Upvote 0
Upping this for my side of the world.

Thanks
 
Upvote 0
Im upping this for the otherside of the world.
Sorry if i am upping this too much, but im willing to finish my second project on the company.

See you when I wake up, means I Will up this again for my side of the world

Any help is greatly appreciated

Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,111
Messages
6,123,151
Members
449,098
Latest member
Doanvanhieu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top