Hi everyone,
I'm trying to modify the VBA found: https://www.rondebruin.nl/win/s4/win001.htm to delete rows based on the cells length instead of the cells content. The website's example deletes rows that contain "ron" and the VBA works as expected. I would to like to modify so that it deletes the entire row if the cell's length in column A = 14.
Any suggestions on how to modify this code to Delete the Entire Row where the Cell Length in Column A = 14?
I've tried these adjustments and receive a "Run-time error '438': Object doesn't support this property or method error message.
Thanks,
Ben
I'm trying to modify the VBA found: https://www.rondebruin.nl/win/s4/win001.htm to delete rows based on the cells length instead of the cells content. The website's example deletes rows that contain "ron" and the VBA works as expected. I would to like to modify so that it deletes the entire row if the cell's length in column A = 14.
Any suggestions on how to modify this code to Delete the Entire Row where the Cell Length in Column A = 14?
Code:
Dim Firstrow As LongDim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With ActiveSheet
.Select
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
.DisplayPageBreaks = False
Firstrow = .UsedRange.Cells(7).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
For Lrow = Lastrow To Firstrow Step -1
With .Cells(Lrow, "A")
If Not IsError(.Value) Then
If .Value = "ron" Then .EntireRow.Delete
End If
End With
Next Lrow
End With
I've tried these adjustments and receive a "Run-time error '438': Object doesn't support this property or method error message.
Code:
With .Cells(Lrow, "A")
If Not IsError(.Value) Then
If .Len = "14" Then .EntireRow.Delete
End If
End With
Code:
With .Cells(Lrow, "A")
If Not IsError(.Len) Then
If .Len = 14 Then .EntireRow.Delete
End If
End With
Thanks,
Ben