I'm not sure what I'm even using is a macro, but I got it to kind of work. If a cell N1 on the worksheet contains a variable number 1-50 (signifies number of people), it will figure out what cells to unhide (will print like 9 people per page). I got it working correctly, the problem is when the cell that is being referenced (the one with the variable number) pulls the number from another worksheet (e.g. ='DATA SHEET'!I54), it does not update like when I manually type a number into that cell.
Here's the formula I'm using to display the cells I want:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("N1")) Is Nothing Then
Rows("3:252").Hidden = True
Select Case Target.Value
Case Is <= 9
Rows("3:47").Hidden = False 'Page 1
Case Is <= 18
Rows("3:92").Hidden = False 'Page 2
Case Is <= 27
Rows("3:137").Hidden = False 'Page 3
Case Is <= 36
Rows("3:182").Hidden = False 'Page 4
Case Is <= 45
Rows("3:227").Hidden = False 'Page 5
Case Is > 45
Rows("3:252").Hidden = False 'Page 6
Case Else
Rows("3:252").Hidden = True
End Select
End If
End Sub
Can anyone tell me how to get this to work right?
Bookmarks