A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to remove multiple empty lines in a table



 
 
Thread Tools Display Modes
  #1  
Old March 14th, 2007, 05:24 PM posted to microsoft.public.word.tables
Francis4344
external usenet poster
 
Posts: 2
Default How to remove multiple empty lines in a table

Sure, you can select and remove a line but this table was generated from an
Wp document with an empty line at every other line...

Any way of telling Word, either through a macro or otherwise, to remove all
empty lines?
  #2  
Old March 14th, 2007, 11:35 PM posted to microsoft.public.word.tables
Jezebel
external usenet poster
 
Posts: 1,369
Default How to remove multiple empty lines in a table

Easy enough to write a macro to do it, if you know how to write macros.
Depending on what your rows contain, you could also simply sort the table:
then the empty rows come together and you can delete them in one action.




"Francis4344" wrote in message
...
Sure, you can select and remove a line but this table was generated from
an
Wp document with an empty line at every other line...

Any way of telling Word, either through a macro or otherwise, to remove
all
empty lines?



  #3  
Old March 16th, 2007, 11:56 PM posted to microsoft.public.word.tables
Access101
external usenet poster
 
Posts: 118
Default How to remove multiple empty lines in a table

And if you want to maintain the same order as the original, just add a
column, auto number it, and then resort after the deletions

"Jezebel" wrote:

Easy enough to write a macro to do it, if you know how to write macros.
Depending on what your rows contain, you could also simply sort the table:
then the empty rows come together and you can delete them in one action.




"Francis4344" wrote in message
...
Sure, you can select and remove a line but this table was generated from
an
Wp document with an empty line at every other line...

Any way of telling Word, either through a macro or otherwise, to remove
all
empty lines?




  #4  
Old March 18th, 2007, 07:05 PM
Henk57 Henk57 is offline
Senior Member
 
First recorded activity by OfficeFrustration: Oct 2006
Posts: 387
Send a message via Skype™ to Henk57
Default

Quote:
Originally Posted by Francis4344 View Post
Sure, you can select and remove a line but this table was generated from an
Wp document with an empty line at every other line...

Any way of telling Word, either through a macro or otherwise, to remove all
empty lines?
A macro is best when you have a huge number of tables or lines to remove. But if the number is small, maybe remove one row, go the next row you want to remove and {Ctrl}+Y works easier (Ctrl+Y is repeating the last action). After this go the the next row to be removed and repeat Ctrl+Y.
Henk
  #5  
Old March 24th, 2007, 12:52 AM posted to microsoft.public.word.tables
Suzanne S. Barnhill
external usenet poster
 
Posts: 31,786
Default How to remove multiple empty lines in a table

Auto numbering will be updated when you sort, so it won't help much.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Access101" wrote in message
...
And if you want to maintain the same order as the original, just add a
column, auto number it, and then resort after the deletions

"Jezebel" wrote:

Easy enough to write a macro to do it, if you know how to write macros.
Depending on what your rows contain, you could also simply sort the

table:
then the empty rows come together and you can delete them in one action.




"Francis4344" wrote in message
...
Sure, you can select and remove a line but this table was generated

from
an
Wp document with an empty line at every other line...

Any way of telling Word, either through a macro or otherwise, to

remove
all
empty lines?





  #6  
Old March 25th, 2007, 11:10 PM posted to microsoft.public.word.tables
Klaus Linke
external usenet poster
 
Posts: 401
Default How to remove multiple empty lines in a table

And if you want to maintain the same order as the original, just add a
column, auto number it, and then resort after the deletions



"Suzanne S. Barnhill" wrote:
Auto numbering will be updated when you sort, so it won't help much.


SEQ fields won't unless you update fields, and it's pretty easy to put one
into an otherwise empty column (... copy the field, select column, paste).

Klaus


  #7  
Old October 10th, 2007, 08:57 AM posted to microsoft.public.word.tables
Kon
external usenet poster
 
Posts: 1
Default How to remove multiple empty lines in a table

I think that you are talking about excel, not word. I was wondering how to
do it in word by vba for some time now and would appreciate help
  #8  
Old October 10th, 2007, 09:40 AM posted to microsoft.public.word.tables
macropod
external usenet poster
 
Posts: 1,231
Default How to remove multiple empty lines in a table

Hi Kon,

The following code will delete all blank rows (except for those with vertically merged cells) in all tables in the active document:

Sub DelBlankRows()
Dim Pwd As String
Dim oRow As Integer
Dim oTable As Table
Dim pState As Boolean
With ActiveDocument
pState = False
If .ProtectionType wdNoProtection Then
Pwd = InputBox("PleasePassword", "Password")
pState = True
.Unprotect Pwd
End If
If .Tables.Count 0 Then
For Each oTable In .Tables
For oRow = oTable.Rows.Count To 1 Step -1
If Len(Replace(oTable.Rows(oRow).Range.Text, Chr(13) & Chr(7), vbNullString)) = 0 Then
On Error Resume Next 'skip vertically merged cells
oTable.Rows(oRow).Delete
End If
Next oRow
Next oTable
End If
If pState = True Then .Protect wdAllowOnlyFormFields, Noreset:=True, Password:=Pwd
pState = False
Pwd = ""
End With
End Sub

If the document is protected for forms, you'll need to replace "Password" with the real password (if any)

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"Kon" wrote in message . ..
I think that you are talking about excel, not word. I was wondering how to
do it in word by vba for some time now and would appreciate help

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:29 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.