Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2022, 06:42 AM
lourid lourid is offline Deleting rows Windows 10 Deleting rows Office 2010
Novice
Deleting rows
 
Join Date: Feb 2022
Posts: 11
lourid is on a distinguished road
Default Deleting rows

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.
Attached Files
File Type: xlsx prova.xlsx (17.3 KB, 8 views)
Reply With Quote
  #2  
Old 03-14-2022, 04:09 PM
rollis13's Avatar
rollis13 rollis13 is offline Deleting rows Windows 10 Deleting rows Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

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
Reply With Quote
  #3  
Old 03-15-2022, 03:44 AM
lourid lourid is offline Deleting rows Windows 10 Deleting rows Office 2010
Novice
Deleting rows
 
Join Date: Feb 2022
Posts: 11
lourid is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 03-15-2022, 08:26 AM
rollis13's Avatar
rollis13 rollis13 is offline Deleting rows Windows 10 Deleting rows Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

You could have done that by yourself; just add to the array the items: "Ore La" and "GG.*" with the "*" for the jolly characters.
Reply With Quote
  #5  
Old 03-15-2022, 08:53 AM
lourid lourid is offline Deleting rows Windows 10 Deleting rows Office 2010
Novice
Deleting rows
 
Join Date: Feb 2022
Posts: 11
lourid is on a distinguished road
Default

OK done!!! Thank you very much
Reply With Quote
  #6  
Old 03-15-2022, 09:39 AM
rollis13's Avatar
rollis13 rollis13 is offline Deleting rows Windows 10 Deleting rows Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 140
rollis13 will become famous soon enough
Default

Thanks for the positive feedback, glad having been of some help.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting rows 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 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 Deleting rows with specific criteria joflow21 Excel 9 11-22-2013 12:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft