![]() |
#6
|
|||
|
|||
![]()
Hallo Greg,
Thank you for replay. Its getting better but ...some little things: The process is specific for 3 tables. There are many tables in the document, and I don't want to check al the tables. So I changed it a bit and use the bookmarks to find the table. Table 11 and 15 are working OK. ![]() But table 9 not. Only the last row will be deleted even if there is data in the row. ![]() The row has 11 coulombs, in coulomb 1 and 7 there's data to ignore. Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim lngIndex As Long, lngLength As Long Dim oRow As Row 'check table 9 Selection.GoTo What:=wdGoToBookmark, Name:="RM1a" Do Set oRow = Selection.Tables(1).Rows.Last lngLength = 0 For lngIndex = 2 To 5 lngLength = lngLength + Len(oRow.Cells(lngIndex).Range.Text) Next lngIndex Selection.Tables(1).Rows.Last.Delete Exit Do Loop Selection.Tables(1).Rows.Last.Borders(wdBorderBottom).Color = Selection.Tables(1).Rows.First.Borders(wdBorderTop).Color 'check table 11 Selection.GoTo What:=wdGoToBookmark, Name:="ItemNr0" Do If Len(Selection.Tables(1).Rows.Last.Range.Text) = 10 Then Selection.Tables(1).Rows.Last.Delete Else Exit Do End If Loop Selection.Tables(1).Rows.Last.Borders(wdBorderBottom).Color = Selection.Tables(1).Rows.First.Borders(wdBorderTop).Color 'Check table 15 Selection.GoTo What:=wdGoToBookmark, Name:="OvopItem1" Do If Len(Selection.Tables(1).Rows.Last.Range.Text) = 8 Then Selection.Tables(1).Rows.Last.Delete Else Exit Do End If Loop Selection.Tables(1).Rows.Last.Borders(wdBorderBottom).Color = Selection.Tables(1).Rows.First.Borders(wdBorderTop).Color End Sub So the data starts in the 3e row. Is it possible for table 11 and 15 to check the 3 row thirst for data in coulomb 3 and 4, if there is no data place a text in second row: 'No problems'. So there is always one row with a message. Table 9 has to be completely delectated when there is no data at al. I hope you would help me again! GrZ ViBoR Holland |
Tags |
empty cell delete row |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
braddgood | Word VBA | 15 | 10-02-2015 01:54 PM |
![]() |
Linh | Word Tables | 1 | 09-21-2014 01:52 PM |
Creating VBA Code to Delete Empty Column in Table | Faugs | Word VBA | 5 | 08-07-2014 03:29 PM |
Delete lots of empty space between paragraphs. | FieldTechnician | Word | 4 | 10-25-2013 01:14 PM |
![]() |
ubns | Excel Programming | 2 | 08-14-2012 02:01 AM |