Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 08-07-2014, 03:29 PM
macropod's Avatar
macropod macropod is offline Creating VBA Code to Delete Empty Column in Table Windows 7 32bit Creating VBA Code to Delete Empty Column in Table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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 could use:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Tbl As Table, i As Long
For Each Tbl In ActiveDocument.Tables
  With Tbl.Range
    For i = .Cells.Count To 1 Step -1
      .Cells(i).Range.Select
      If Len(.Cells(i).Range.Text) = 2 Then .Columns(.Cells(i).ColumnIndex).Delete
      If i > .Cells.Count Then i = .Cells.Count
    Next
  End With
Next
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating VBA Code to Delete Empty Column in Table Macro to delete all empty rows from all tables braddgood Word VBA 15 10-02-2015 01:54 PM
Creating VBA Code to Delete Empty Column in Table Delete row when 2 column has no value Rok Word VBA 1 11-26-2013 01:59 AM
Creating VBA Code to Delete Empty Column in Table Unable to open or delete an empty folder Zimm Windows 4 11-19-2013 05:07 PM
Delete lots of empty space between paragraphs. FieldTechnician Word 4 10-25-2013 01:14 PM
Creating VBA Code to Delete Empty Column in Table 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 01:49 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