DominicPAH
New Member
- Joined
- Oct 10, 2017
- Messages
- 8
Hi all
I have a spreadsheet with over 5000 records however I need to do very little with some of them so I am looking for a VBA to do a lot of my work for me. I have made a start but with little success.
Basically, I want to run the VBA to take the following actions:
1. Delete Rows if Column F contains any of the following IRO05, IRO11-1, IRO15, IRO16, IRO17, IRO18 or IRO19
2.Delete Row if Column M contains WOFF
3.Enter WOFF in column P if any of the following is true
a. K >0 and < 10
b. K >10 and <100 and N >H
What I have so far (trying point 1 only) is
Sub FormerTenantCheck()
Dim startRow As Long, lastRow As Long
startRow = 2
lastRow = Sheet1.Cells(Sheet1.Row.Count,1).End(clUp).Row
Dim i As Long, Admin As Long
Dim sClass As String
For I = startRow to lastRow
Admin =ActiveSheet.Range(“F” & i).value
If Admin = IRO05 or Admin = IRO15 or Admin = IRO16 or Admin= IRO17 or Admin = IRO18 or Admin = IRO19 or Admin = IRO11-1 Then
.entireRow.Delete
Else
End If
Next
End Sub
The above does not work. The sheet name is Account
I have a spreadsheet with over 5000 records however I need to do very little with some of them so I am looking for a VBA to do a lot of my work for me. I have made a start but with little success.
Basically, I want to run the VBA to take the following actions:
1. Delete Rows if Column F contains any of the following IRO05, IRO11-1, IRO15, IRO16, IRO17, IRO18 or IRO19
2.Delete Row if Column M contains WOFF
3.Enter WOFF in column P if any of the following is true
a. K >0 and < 10
b. K >10 and <100 and N >H
What I have so far (trying point 1 only) is
Sub FormerTenantCheck()
Dim startRow As Long, lastRow As Long
startRow = 2
lastRow = Sheet1.Cells(Sheet1.Row.Count,1).End(clUp).Row
Dim i As Long, Admin As Long
Dim sClass As String
For I = startRow to lastRow
Admin =ActiveSheet.Range(“F” & i).value
If Admin = IRO05 or Admin = IRO15 or Admin = IRO16 or Admin= IRO17 or Admin = IRO18 or Admin = IRO19 or Admin = IRO11-1 Then
.entireRow.Delete
Else
End If
Next
End Sub
The above does not work. The sheet name is Account