VBA and formula

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
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Maybe
Code:
[COLOR=#000000][FONT=Calibri]If Admin = "IRO05" or Admin = "IRO15" or Admin = "IRO16" or Admin= "IRO17" or Admin = "IRO18" or Admin = "IRO19" or Admin = "IRO11-1" Then
Rows(i).Delete
[/FONT][/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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