gentleGiant
New Member
- Joined
- Sep 9, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hello,
I am new to VBA and need some help. I am trying to delete all the rows of data that I do not want based on the names of people that I do want the call logs for. I think I almost have it figured out but I don't know how to check against an array. The actual spreadsheet I am working with has about 15k rows with over 150 names and I only want data for 40 of the names and delete the rest.
Any help is greatly appreciated!
Sub PhoneLogs()
Dim StatusCol As Range
Dim Status As Range
Dim LR As Long
'These are all the folks on the Team I want to get call logs for
MyArray = Array("Daisy", "Donald Duck")
'This gets the last row number
LR = Cells(Rows.Count, 1).End(xlUp).Row
'This sets the area for "StatusCol" variable from A2 to Last row that has data
Set StatusCol = Range("A2:A" & LR)
For Each Status In StatusCol
'This is what I need help with, I don't know how to check against an array
If "Status is not in Array" Then
Status.EntireRow.ClearContents
End If
Next Status
End Sub
I am new to VBA and need some help. I am trying to delete all the rows of data that I do not want based on the names of people that I do want the call logs for. I think I almost have it figured out but I don't know how to check against an array. The actual spreadsheet I am working with has about 15k rows with over 150 names and I only want data for 40 of the names and delete the rest.
Any help is greatly appreciated!
Sub PhoneLogs()
Dim StatusCol As Range
Dim Status As Range
Dim LR As Long
'These are all the folks on the Team I want to get call logs for
MyArray = Array("Daisy", "Donald Duck")
'This gets the last row number
LR = Cells(Rows.Count, 1).End(xlUp).Row
'This sets the area for "StatusCol" variable from A2 to Last row that has data
Set StatusCol = Range("A2:A" & LR)
For Each Status In StatusCol
'This is what I need help with, I don't know how to check against an array
If "Status is not in Array" Then
Status.EntireRow.ClearContents
End If
Next Status
End Sub