Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-07-2016, 03:50 PM
macropod's Avatar
macropod macropod is online now Determine if a cell contains a 0 value Windows 7 64bit Determine if a cell contains a 0 value Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You don't say which column the 0 values are in. The following macro processes all tables in the document, deleting those rows that have 0 values in column 2. You can change to column reference to suit your needs.
Code:
Sub DeleteTable0Rows()
Dim Tbl As Table, i As Long, Rng As Range
With ActiveDocument
  For Each Tbl In .Tables
    With Tbl
      For i = .Rows.Count To 1 Step -1
        Set Rng = .Cell(Row:=1, Columns:=2)
        With Rng
          .End = .End - 1
          If .Text = "0" Or .Text = "0.0" Or .Text = ".0" Then .Rows(1).Delete
        End With
      Next
    End With
  Next
End With
Set Rng = Nothing: Set Tbl = Nothing
End Sub

__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
cell value, if statement, read cell



Similar Threads
Thread Thread Starter Forum Replies Last Post
determine location of object via calculation sarahtalbot Visio 0 01-08-2015 03:27 AM
Determine if a shape is selected Byron Polk Word VBA 2 08-06-2014 02:26 AM
Determine if a cell contains a 0 value Determine Visio 2010 version bbelko Misc 1 10-24-2013 08:40 AM
Determine if a cell contains a 0 value * Determine Capitalization djreyrey Excel 8 05-03-2011 02:03 PM
Determine if a cell contains a 0 value Determine age by using birthdate gdodson Excel 1 08-11-2006 09:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:09 AM.


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