View Single Post
 
Old 04-26-2015, 05:19 AM
vibor vibor is offline Windows XP Office 2003
Novice
 
Join Date: Feb 2015
Posts: 5
vibor is on a distinguished road
Post Delete row with empty cel in a table

Hello,

A process is filling a words document (MS Words 2007).
A table in this document has 60 row's. Depending on the process there are 1 or all 60 rows filled.
Every cell has a bookmark. (3 cells in a row, number, problem, solution)
I know how to find the cells and how to select and delete the row.
I want delete the empty rows starting at the end.
When there is data/content, than stop macro.

My problem is:
1 How do I check the cell if its empty?
2 Do I have to repeat the routine 60 times, or is there a other way?
This is what I have:

Sub DeleteLegeRegel()
Selection.GoTo What:=wdGoToBookmark, Name:="Prob60"

(CHECK CEL FOR DATA, HOW?)

If empty Then
Selection.Expand (wdRow)
Selection.Cut
Selection.GoTo What:=wdGoToBookmark, Name:="Prob59"
(CHECK CEL FOR DATA, HOW?)

If empty Then
Selection.Expand (wdRow)
Selection.Cut
Selection.GoTo What:=wdGoToBookmark, Name:="Prob58"


Else
Selection.GoTo What:=wdGoToBookmark, Name:="Prob59"

End If

End Sub


It shout be simple, but I can't find a proper example.

Grtz Vincent
Reply With Quote