Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2012, 04:34 PM
ubns ubns is offline Delete table cells if nothing is filled Windows 7 32bit Delete table cells if nothing is filled Office 2010 32bit
Competent Performer
Delete table cells if nothing is filled
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default Delete table cells if nothing is filled

Hi,



Please find the attached document.

We merge this document in a application and it prepopulates the information in the cells.

If there is no information - then it comes as blank.

Is it possible to develop a macro or something like that - to delete the entire rows of the tables; if there is no information populated in the cells - meaning all (fillable cells in a row are blank then delete the entire row).

Regards

Umesh Banga
Attached Files
File Type: zip AXA_Individual_Fact_Find_120529.zip (348.9 KB, 10 views)
Reply With Quote
  #2  
Old 09-04-2012, 07:36 PM
gmaxey gmaxey is offline Delete table cells if nothing is filled Windows XP Delete table cells if nothing is filled Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub ScratchMacro()
'A quick macro scratch pad created by Greg Maxey
Dim i As Long
Dim lngCount As Long
For i = ActiveDocument.Tables(1).Rows.Count To 1 Step -1
  lngCount = ActiveDocument.Tables(1).Rows(i).Cells.Count * 2 + 2
  If Len(ActiveDocument.Tables(1).Rows(i).Range.Text) = lngCount Then
    ActiveDocument.Tables(1).Rows(i).Delete
  End If
Next
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/

Last edited by macropod; 09-04-2012 at 08:22 PM. Reason: Added code tags & formatting
Reply With Quote
  #3  
Old 09-04-2012, 08:21 PM
macropod's Avatar
macropod macropod is offline Delete table cells if nothing is filled Windows 7 64bit Delete table cells if nothing is filled Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,366
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

Umesh,

I have previously provided you with a quite extensive macro that includes, amongst other things, code for deleting blank rows.

Rather than simply treating this forum as a free coding resource, it would be better if you invested some time in seeing how previously solutions might be adapted to new situations.

Of course, we're always here to help if you get stuck.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 09-04-2012, 09:28 PM
ubns ubns is offline Delete table cells if nothing is filled Windows 7 32bit Delete table cells if nothing is filled Office 2010 32bit
Competent Performer
Delete table cells if nothing is filled
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Hi,

I have tried the code but due to the table having vertically merged cell (the first column) it is throwing the error (see attached).

Anyone got the solution for the debug issue?
Attached Images
File Type: png Delete Empty rows.PNG (13.7 KB, 10 views)
Reply With Quote
  #5  
Old 09-06-2012, 04:41 PM
macropod's Avatar
macropod macropod is offline Delete table cells if nothing is filled Windows 7 64bit Delete table cells if nothing is filled Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,366
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

Your attached document really isn't amenable to a simple deletion of empty rows. With vertically merged cells in the first two columns, spanning different rows, and vertically split cells in the remaining two columns, it becomes somewhat challenging to determine what constitutes a 'row' in a given instance (in fact, it's generally not a row you're dealing with at all but a series of cells within a row) and which cells should be deleted.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete table cells if nothing is filled Macro to delete rows with all empty cells ubns Excel Programming 2 08-14-2012 02:01 AM
Delete table cells if nothing is filled VBA and hyperlinks in table cells viuf PowerPoint 13 02-19-2012 10:34 AM
Delete table cells if nothing is filled Word VBA: add textboxs in table cells? tinfanide Word VBA 12 02-09-2012 12:05 AM
Delete table cells if nothing is filled put a border around table cells that have text in them tonywatsonmail Mail Merge 1 01-31-2012 04:37 AM
Delete table cells if nothing is filled Combining Text from Table Cells robmorleyuk Word 1 11-01-2011 07:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:24 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