Delete cells in an Excel column when rows = 0

前端 未结 4 1922
有刺的猬
有刺的猬 2020-11-28 16:19

I am trying to delete all cells =0 in a column in my spreadsheet and \"summon\" the values which don\'t to the top of the column.

I am currently using



        
4条回答
  •  盖世英雄少女心
    2020-11-28 16:40

    Yes, there is:

    Sub DoMAcro()
        Dim lastRow As Integer
    
        lastRow = Cells(1000, 16).End(xlUp).Row
    
        Range(Cells(7, 16), Cells(lastRow, 16)).Replace What:="0", Replacement:="", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    End Sub
    

提交回复
热议问题