I am looking for a macro that will do the things mentioned below
macro will be placed in a macro.xlsm
sample.xls & macro.xlsm both are loacted at different places, So the path should be hardcoded in the macro so that i can change it as per my needs
sheet name can be anything
If column D of sample.xls is equal to column E of sample.xls Or column D of sample.xls is equal to column F of sample.xls then do nothing else put that data into new sheet by creating a new sheet in it & remove that data from current sheet(plz see the sample file)
https://drive.google.com/file/d/19xXPm6 ... sp=sharing
https://drive.google.com/file/d/1LFJP0R ... sp=sharing
Code: Select all
Sub VenA()
Dim Wb1 As Workbook
Set Wb1 = Workbooks.Open("C:UsersWolfieeeStyleDesktop1.xls")
Set Ws1 = Wb1.Worksheets.Item(1)
With Ws1
.Cells(2, 15).FormulaR1C1 = "=AND(RC[-11]RC[-10],RC[-11]RC[-9])"
With .Cells(1).CurrentRegion
.AdvancedFilter xlFilterCopy, .Range("O1:O2"), Sheets.Add(, Sheets(Sheets.Count)).Cells(1)
.AdvancedFilter xlFilterInPlace, .Range("O1:O2")
.Offset(1).EntireRow.Delete
End With
.ShowAllData
.Cells(2, 15).Clear
End With
Wb1.Save
Wb1.Close
End Sub
https://www.excelforum.com/excel-progra ... ost5367371