AndrewGKenneth
Board Regular
- Joined
- Aug 6, 2018
- Messages
- 59
Hi There,
I am having an issue with some code I have created. What I would like to achieve is on my worksheet "Drawings" if the value in Column B is the same as Column F then the entire row will be deleted automatically.
Here is the code I currently have:
Dim rng As Range, DelRng As Range
Dim LastRow As Long
Dim Value As String
On Error Resume Next
If Not Sheets("Drawings").Range("B2").Value = "" Then
Lrow = Sheets("Drawings").Range("$B$2:B2")
For Each rng in DelRng
If rng.Value = Sheets("Drawings").Range("F2").Value then
Rng.EntireRow.Delete
End If
Next
End If
End Sub
The problem is with my current code it is only deleting the first row not scanning through the entire sheet and deleting any rows where B and F have the same value.
Could someone please assist me? Thanks in advance!
Kind Regards,
Andrew
I am having an issue with some code I have created. What I would like to achieve is on my worksheet "Drawings" if the value in Column B is the same as Column F then the entire row will be deleted automatically.
Here is the code I currently have:
Dim rng As Range, DelRng As Range
Dim LastRow As Long
Dim Value As String
On Error Resume Next
If Not Sheets("Drawings").Range("B2").Value = "" Then
Lrow = Sheets("Drawings").Range("$B$2:B2")
For Each rng in DelRng
If rng.Value = Sheets("Drawings").Range("F2").Value then
Rng.EntireRow.Delete
End If
Next
End If
End Sub
The problem is with my current code it is only deleting the first row not scanning through the entire sheet and deleting any rows where B and F have the same value.
Could someone please assist me? Thanks in advance!
Kind Regards,
Andrew