FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,364
- 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>
</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 | |
---|---|---|
1 | ||
2 | Out | |
3 | ||
4 | ||
5 | ||
6 | ||
7 | 1 | |
8 | 1 | |
9 | 1 | |
10 | ||
11 | 2 | |
12 | 2 | |
13 | 2 | |
14 | 2 | |
15 | 2 | |
16 | ||
17 | ||
18 | ||
19 | ||
20 |
<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1
<strike>
</strike>