Forum Discussion
a_bonsey
May 16, 2022Brass Contributor
vba table valid row count
Hi, I'm supplied Word documents that contain a table that has differing valid rows therefore I need a variable to count the valid rows. In Excel this would be something like: Sub Test()
Wi...
a_bonsey
Brass Contributor
Hi,
I tried tweaking the vba slightly to see what a debug/msgbox would should for the cell(i,1). In the debug (and Msgbox) I get a 'rectangular box' appearing (see attached image).
Are you able to tell me what causes this to appear?
May 18, 2022
a_bonsey The range of an empty cell in a Word table has a length of 2. Therefore, the code checks to see if the length of the range of each cell is < 3. If it is, then the row is not valid according to your nomenclature.
In the Immediate Window, you should enter
MsgBox Len(Selection.Cells(1).Range)
when the selection is in a cell.