delete rows stopped working VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mikael3432
    New Member
    • Aug 2010
    • 24

    #1

    delete rows stopped working VBA

    this code worked fine yesterday, but not today.
    When I run the code step by step, the deleted rows comes back with end With. Why?

    Code:
    Sub DeleteRowsBasedOnCriteria()
    With ActiveSheet
    If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
    .Range("A1").AutoFilter Field:=1, Criteria1:="Delete"
     .Range("A1").CurrentRegion.Offset(1,0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
     .AutoFilterMode = False
    End With
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    Some example data would be essential to know what's happening Mikael. Also, it's a good idea to indicate when a question is about Excel in the title when posting to a predominantly Access forum.

    Comment

    • mikael3432
      New Member
      • Aug 2010
      • 24

      #3
      oh. Ya its excel VBA not access. Wrong forum?
      and the data in the sheet dosnt matter.
      The deleted data returns back when VBA comes to "end With"

      Comment

      • mikael3432
        New Member
        • Aug 2010
        • 24

        #4
        I removed some of the code and it worked. problem solved.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32669

          #5
          Originally posted by Mikael
          Mikael:
          The deleted data returns back when VBA comes to "end With"
          That will be because of the data I expect.

          If you feel replying to a question asked by someone trying to help "doesn't matter" then perhaps I'd better leave you to yourself. I'm used to better manners than that.

          Comment

          Working...