B
Bigfoot17
I have a Useform gathering info and placing it into FormFields in my
document. I have a table (2 col and 4 row) that holds eight of the many
formfields (txtCt1 through 8).
What I am trying to do do is delete rows if not needed. Here is the code
that I was tring to run but which does not work for me, followed by what I
thought the code would do.
j = 0
For k = 1 To 8
If TextBox & k > "" Then
j = j + 1
End If
Next k
If j = 1 Or j = 2 Then
ActiveDocument.Tables(2).Rows(4).Delete
ActiveDocument.Tables(2).Rows(3).Delete
ActiveDocument.Tables(2).Rows(2).Delete
ElseIf j = 3 Or j = 4 Then
'ActiveDocument.Tables(2).Rows(4).Delete
'ActiveDocument.Tables(2).Rows(3).Delete
Selection.Tables(2).Rows(4).Delete 'I saw this in another post
Selection.Tables(2).Rows(3).Delete 'I saw this in another post
ElseIf j = 5 Or j = 6 Then
ActiveDocument.Tables(2).Rows(4).Delete
End If
Check TextBoxes 1 through 8 (k) on the userform and count how many have
content.
If only the first two have content delete rows 2-4 off of the table.
If ony the first four have content delete rows 3 &4 of the table.
I have a couple of tables in the documetn so I am not sure how to identlfy
which table I am trying to delete the rows from, plus apparently I am not
deleting rows from any of my tables so I need help!
Thank you.
document. I have a table (2 col and 4 row) that holds eight of the many
formfields (txtCt1 through 8).
What I am trying to do do is delete rows if not needed. Here is the code
that I was tring to run but which does not work for me, followed by what I
thought the code would do.
j = 0
For k = 1 To 8
If TextBox & k > "" Then
j = j + 1
End If
Next k
If j = 1 Or j = 2 Then
ActiveDocument.Tables(2).Rows(4).Delete
ActiveDocument.Tables(2).Rows(3).Delete
ActiveDocument.Tables(2).Rows(2).Delete
ElseIf j = 3 Or j = 4 Then
'ActiveDocument.Tables(2).Rows(4).Delete
'ActiveDocument.Tables(2).Rows(3).Delete
Selection.Tables(2).Rows(4).Delete 'I saw this in another post
Selection.Tables(2).Rows(3).Delete 'I saw this in another post
ElseIf j = 5 Or j = 6 Then
ActiveDocument.Tables(2).Rows(4).Delete
End If
Check TextBoxes 1 through 8 (k) on the userform and count how many have
content.
If only the first two have content delete rows 2-4 off of the table.
If ony the first four have content delete rows 3 &4 of the table.
I have a couple of tables in the documetn so I am not sure how to identlfy
which table I am trying to delete the rows from, plus apparently I am not
deleting rows from any of my tables so I need help!
Thank you.