![]() |
|
|
|
#1
|
||||
|
||||
|
Converting the table to text is unlikely to resolve your problems.
The following macro will repair all except the last row of your table: Code:
Sub FixTable()
Application.ScreenUpdating = False
Dim r As Long, c As Long, RngSrc As Range, RngTgt As Range
With ActiveDocument.Tables(1)
For r = .Rows.Count To 3 Step -1
IsDate (Trim(Split(.Cell(r, 1).Range.Text, vbCr)(0)))
If IsDate(Trim(Split(.Cell(r, 1).Range.Text, vbCr)(0))) = False Then
For c = 1 To .Rows(r).Cells.Count
Set RngSrc = .Cell(r, c).Range
If RngSrc.Paragraphs.Count > 1 Then
RngSrc.End = RngSrc.Paragraphs(1).Range.End - 1
Set RngTgt = .Cell(r - 1, c).Range
With RngTgt
.End = .End - 1
.Collapse wdCollapseEnd
.FormattedText = RngSrc.FormattedText
.InsertBefore " "
End With
RngSrc.Paragraphs(1).Range.Text = vbNullString
End If
Next
End If
Next
End With
Application.ScreenUpdating = True
End Sub
For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#2
|
|||
|
|||
|
Paul. Thanks for writing the macro. What is the macro exactly for. ? I don't see much change in the table. After inserting the code in a module, the rows are still not in the order as per date. I also tried copying the document to excel and the values at each row at each change in display are not showing in order. The value connected to one date is merged with the next date.
This is the first time I have inserted a module in the word document and saved it as Word micro enabled document. I hope I have done it right. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to draw a trendline but not show the original line? | Sunny Rio | Word | 0 | 09-03-2022 05:55 PM |
How to draw a cross mark on a vertical line?
|
kingston123 | Drawing and Graphics | 4 | 09-19-2018 03:44 AM |
How to draw double line border for a Cell
|
phamh | PowerPoint | 2 | 10-21-2014 02:26 PM |
I draw a line, an arrow comes up instead
|
ZapoTeX | PowerPoint | 1 | 11-06-2012 02:03 AM |
how to draw line diagram with x yr yl
|
gsrikanth | Excel | 1 | 03-07-2012 05:50 AM |