![]() |
|
#1
|
|||
|
|||
|
Hello I would need to delete, starting from line 28, the empty lines and those that in column A begin with Dal;X; 44;VIA;20154;Ore;GG,;RIEPILOGO GENERALE the file is not always the same length. |
|
#2
|
||||
|
||||
|
Have a try with this macro:
Code:
Option Explicit
Sub EliminaRigheConArray()
Dim mioArr As Variant
Dim y As Long
Application.ScreenUpdating = False
mioArr = Array("", "Dal dip", "X Dat", "4432 A", "VIA PRI", "20154", "339075")
With ActiveSheet
For y = LBound(mioArr) To UBound(mioArr)
.AutoFilterMode = False
With Range("A28", Range("A" & Rows.Count).End(xlUp))
.AutoFilter 1, mioArr(y)
On Error Resume Next
If mioArr(y) = "" Then
.Offset(1).SpecialCells(4).EntireRow.Delete 'xlCellTypeBlanks
Else
.Offset(1).SpecialCells(12).EntireRow.Delete 'xlCellTypeVisible
End If
End With
Next y
.AutoFilterMode = False
End With
Application.ScreenUpdating = True
MsgBox "Done!"
End Sub
|
|
#3
|
|||
|
|||
|
thanks for the macro.
it is possible to delete the lines that contain or start with Ore and GG. the cell in A1 could be made up of Ore + other words or GG. plus other words |
|
#4
|
||||
|
||||
|
You could have done that by yourself; just add to the array the items: "Ore La" and "GG.*" with the "*" for the jolly characters.
|
|
#5
|
|||
|
|||
|
OK done!!! Thank you very much
|
|
#6
|
||||
|
||||
|
Thanks for the positive feedback, glad having been of some help.
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
problem with deleting empty rows MS Word VBA
|
nasserlouis | Word VBA | 2 | 08-17-2017 04:00 PM |
| VBA - Deleting Rows (criteria based) | BobbyG | Project | 1 | 07-31-2017 08:55 AM |
Deleting rows based on the text in certain cells VBA
|
ThisGuyJohn | Excel Programming | 5 | 02-03-2017 03:16 PM |
| Deleting rows & pushing them up causing issues | ep2002 | Excel | 2 | 08-29-2014 02:09 AM |
Deleting rows with specific criteria
|
joflow21 | Excel | 9 | 11-22-2013 12:10 PM |