![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
||||
|
||||
|
You could use a macro like: Code:
Sub DelRows()
Application.ScreenUpdating = False
Dim r As Long
With ActiveDocument.Tables(1)
For r = .Rows.Count To 1 Step -1
With .Rows(r)
If .Range.Fields.Count > 0 Then .Delete
End With
Next
End With
Application.ScreenUpdating = True
End Sub
https://wordmvp.com/FAQs/MacrosVBA/AppClassEvents.htm https://wordmvp.com/FAQs/MacrosVBA/I...tSavePrint.htm
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
This VBA works perfectly when I access the Macro window and run it. I explored options yesterday to get it to run when the document is saved or when you click a button but just could not figure out how to accomplish that. I would rather have the empty rows deleted when the file is saved. If you could help me add that code, I would be greatly thankful. I know as I see more of this code, it will bring back what knowledge I have forgotten. Thanks in advance.
|
|
| Tags |
| delete, macro, rows |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro that deletes all empty rows in selected table
|
MathiasFC | Word VBA | 2 | 02-10-2019 04:06 PM |
Delete Empty Table Rows
|
cltay87 | Word VBA | 4 | 02-27-2017 04:23 AM |
Macro to delete all empty rows from all tables
|
braddgood | Word VBA | 15 | 10-02-2015 01:54 PM |
Delete All empty Rows - Print - Undo all Rows deleted
|
Bathroth | Word VBA | 1 | 10-01-2014 01:40 PM |
Macro to delete rows with all empty cells
|
ubns | Excel Programming | 2 | 08-14-2012 02:01 AM |