Consulting

Results 1 to 5 of 5

Thread: Solved: Delete zeros

  1. #1

    Solved: Delete zeros

    Hi.
    Can this changed ?

    [VBA]
    ActiveCell.Resize(, 15).SpecialCells(xlCellTypeBlanks).Delete SHIFT:=xlToLeft
    [/VBA]

    to

    [VBA]
    ActiveCell.Resize(, 15).Cells(xlCell.VALUE=0).Delete SHIFT:=xlToLeft
    [/VBA]

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    just don't show them:

    [VBA]ActiveWindow.DisplayZeros = False[/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Thanks lucas, but i wish to make this code shorter.
    (Show/hide not that i want)
    [vba] Range("A23").Select
    ActiveCell.Resize(, 15).Select
    Selection.Replace What:="0", Replacement:="", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
    ActiveCell.Resize(, 15).SpecialCells(xlCellTypeBlanks).Delete SHIFT:=xlToLeft
    Range("A23").Activate[/vba]

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    [VBA] With Range("A23").Resize(, 15)
    .Replace What:="0", Replacement:="", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
    .SpecialCells(xlCellTypeBlanks).Delete SHIFT:=xlToLeft
    End With[/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    Thanks mdmackillop.
    Probably can not say it in one sentence:
    ActiveCell.Resize(, 15).Cells(xlCell.VALUE=0).Delete SHIFT:=xlToLeft

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •