vlahomt
asked on
Help with vb macro in excel to check a column in active row and delete the row.
I need a macro that will check the cell in the avctive row in a specific column agains a cell on another sheet and then if it does not fit the criteria then delete the row. here is what I have right now.
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Sel ect
Range(Selection, Selection.End(xlToRight)). Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste
Range("A2").Select
Do Until IsEmpty(ActiveCell)
if
activerow(b)<= activesheet.sheet1 range("g1")
then
Selection.EntireRow.Delete
ActiveCell.Offset(1, 0).Select
I have never coded in vb before so I know at least part of my problem is syntax and key words thanks for your help.
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Sel
Range(Selection, Selection.End(xlToRight)).
Selection.Copy
Sheets.Add
ActiveSheet.Paste
Range("A2").Select
Do Until IsEmpty(ActiveCell)
if
activerow(b)<= activesheet.sheet1 range("g1")
then
Selection.EntireRow.Delete
ActiveCell.Offset(1, 0).Select
I have never coded in vb before so I know at least part of my problem is syntax and key words thanks for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
vlahomt,
That is a totally different question to the one you started with. Perhaps you'd like to post another question for that.
Patrick
That is a totally different question to the one you started with. Perhaps you'd like to post another question for that.
Patrick
Here's a file showing it working:
https://filedb.experts-exchange.com/incoming/ee-stuff/4468-vlahomt_01.zip
https://filedb.experts-exchange.com/incoming/ee-stuff/4468-vlahomt_01.zip
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
ASKER
Can I change the scenerio a little bit.
what if I want to test multiple cells on sheet1 and if each cell meets the condition copy the eniter row to a new sheet.
so if cell A1>10 and cell C1<2 and cell F1>0 then copy row 1 to sheet 2 row 1.
then move down a row on sheet 2 to allow for the next row to copy over.