Hi. I'm trying to find/write vba script that will hide only a select number
of rows from a table - so that I deselect a checkbox and it hides say, 10
rows below it. I've found the following code, but it hides ALL rows
underneath it. I only want some. Can someone help me?
Private Sub CheckBox1_Change()
Call ShowHideTable
End Sub
Sub ShowHideTable()
With Selection
.GoTo What:=wdGoToTable, Which:=wdGoToNext, _
Count:=1, Name:=""
.Tables(1).Select
End With
If CheckBox1.Value = True Then
With Selection.Font
.Hidden = False
End With
With ActiveWindow.View
.ShowHiddenText = True
.ShowAll = True
End With
Else
With Selection.Font
.Hidden = True
End With
With ActiveWindow.View
.ShowHiddenText = False
.ShowAll = False
End With
With Selection
.Collapse direction:=wdCollapseStart
.MoveLeft unit:=wdCharacter, Count:=1
End With
End If
End Sub
Dave Lett - 13 Apr 2006 21:41 GMT
Hi,
You can try something like the following:
Dim oTbl As Table
Dim oRng As Range
Set oTbl = ActiveDocument.Tables(1)
Set oRng = ActiveDocument.Range(Start:=oTbl.Rows(2).Range.Start, _
End:=oTbl.Rows(5).Range.End)
oRng.Font.Hidden = True
HTH
Dave
> Hi. I'm trying to find/write vba script that will hide only a select
> number
[quoted text clipped - 34 lines]
> End If
> End Sub