FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
This code works fine, but as I need to adjust my sheet rows and which ones should be visible and/or hidden, I would like to put a number in column A to represent the grouping.
Example, all of the "In" would have a 1 in column A on that row and "Out" would have a 2. So instead of manually changing the code to represent the group of rows, can I use another method to build the strings? Hope this makes sense.
Excel 2016 (Windows) 64 bit
<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Out[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: center"]10[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]11[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]13[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]16[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]17[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]18[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]19[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]20[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
</tbody>
<strike>
</strike>
Code:
[FONT=Verdana]Private Sub Worksheet_Change(ByVal Target As Range)
Me.Cells.EntireRow.Hidden = False
If Not Intersect(Target, Me.Range("B2")) Is Nothing Then
If Target.Value = "In" Then
Me.Rows("7:9").EntireRow.Hidden = True
ElseIf Target.Value = "Out" Then
Me.Rows("11:15").EntireRow.Hidden = True
End If
End If
End Sub
[/FONT]
Example, all of the "In" would have a 1 in column A on that row and "Out" would have a 2. So instead of manually changing the code to represent the group of rows, can I use another method to build the strings? Hope this makes sense.
Excel 2016 (Windows) 64 bit
A | B | |
---|---|---|
<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]2[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Out[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: center"]10[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]11[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]13[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"][/TD]
[TD="align: center"]16[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]17[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]18[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]19[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]20[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]
</tbody>
Sheet1
<strike>
</strike>