Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-01-2014, 01:40 PM
gmaxey gmaxey is offline Delete All empty Rows - Print - Undo all Rows deleted Windows 7 32bit Delete All empty Rows - Print - Undo all Rows deleted Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

You can test the whole row instead of the individual cells:

Code:
Sub PrintAllTest()
Dim oTbl As Table, lngIndex As Long, lngCols As Long, oUndo As UndoRecord
  Application.ScreenUpdating = False
  Set oUndo = Application.UndoRecord
  oUndo.StartCustomRecord ("DeleteRows")
  With ActiveDocument
    For Each oTbl In .Tables
      lngCols = oTbl.Columns.Count
      For lngIndex = oTbl.Rows.Count To 1 Step -1
        If Len(oTbl.Rows(lngIndex).Range) = (2 * lngCols) + 2 Then
          oTbl.Rows(lngIndex).Delete
        End If
      Next lngIndex
    Next oTbl
  End With
  Application.ScreenUpdating = True
  oUndo.EndCustomRecord
  MsgBox Dialogs(wdDialogFilePrint).Show
  ActiveDocument.Undo
lbl_Exit:
  Set oUndo = Nothing
  Set oTbl = Nothing
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Tags
delete rows, undo, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete All empty Rows - Print - Undo all Rows deleted Macro to delete all empty rows from all tables braddgood Word VBA 15 10-02-2015 01:54 PM
Find and Delete Rows damaniam Word VBA 1 03-11-2014 06:54 AM
Delete All empty Rows - Print - Undo all Rows deleted Grouping table rows to prevent individual rows from breaking across pages dennist77 Word 1 10-29-2013 11:39 PM
Delete All empty Rows - Print - Undo all Rows deleted Delete all rows but the last. elky1967 Word VBA 14 09-21-2012 05:27 AM
Delete All empty Rows - Print - Undo all Rows deleted Macro to delete rows with all empty cells ubns Excel Programming 2 08-14-2012 02:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:52 PM.


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