help with simple macro

leonelcuenca

New Member
Joined
Oct 13, 2014
Messages
6
i created a macro that filters on column 13 all cells with blanks and delete them, i need that when the filters shows no result the macro stops


PD: if someone can show me a macro that do this faster than mine ill be really appreciated. The idea of the macro is: filter values on column x with the criteria x and delete the results and when the result is nothing the macro stops..

THANKS A LOT GUYS!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Please post a sample of your current macro and it will be easier for someone to assist you.
 
Upvote 0
Sub auto_open()
'
' auto_op Macro


Application.ScreenUpdating = False
Range("A1:P1").Select
Selection.AutoFilter
If Range("a2") = "" Then GoTo finish:
strCriterio = ""
Selection.AutoFilter Field:=13, Criteria1:=strCriterio
filaIni = ActiveSheet.UsedRange.Row + 1
filafin = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count - 1
If Range("m:m") = "" Then GoTo finalizar:
strRango = CStr(filaIni) + ":" + CStr(filafin)
Rows(strRango).Select
Selection.Delete
Range("A1:P1").Select
Selection.AutoFilter
Selection.AutoFilter
finish:
Application.ScreenUpdating = True
End Sub
 
Upvote 0
maybe

Code:
Option Explicit
Option Explicit
Sub Deleteblanks()
   On Error GoTo err_alert
     Range("A2").CurrentRegion.Columns(13).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
err_alert:
  MsgBox "No suitable rows found to delete", vbCritical, "Finished"
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,591
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top