我在表5(Shaker Spares)上有一个公式,当我将数据输入到表3(Shaker数据输入)单元格C13时,我想自动更新。
我在表5(Shaker Spares)中输入了以下代码:
Private Sub Worksheet_Change(ByVal Target As Range)
Call Shkr_Spares(Target)
End Sub
Private Sub Shkr_Spares(ByVal Target As Range)
If Intersect(Target, Range("C1")) Is Nothing Then Exit Sub
Select Case Target.Value
Case 0
Rows("2:210").EntireRow.Hidden = False
ActiveSheet.Range("C1").Select
Case 1
Rows("2:16").EntireRow.Hidden = False
Rows("17:210").EntireRow.Hidden = True
ActiveSheet.Range("C1").Select
Case 2
Rows("17:67").EntireRow.Hidden = False
Rows("68:210").EntireRow.Hidden = True
Rows("3:16").EntireRow.Hidden = True
ActiveSheet.Range("C1").Select
Case 3
Rows("68:116").EntireRow.Hidden = False
Rows("117:210").EntireRow.Hidden = True
Rows("3:67").EntireRow.Hidden = True
ActiveSheet.Range("C1").Select
Case 4
Rows("117:145").EntireRow.Hidden = False
Rows("146:210").EntireRow.Hidden = True
Rows("3:116").EntireRow.Hidden = True
ActiveSheet.Range("C1").Select
Case 5
Rows("146:161").EntireRow.Hidden = False
Rows("161:210").EntireRow.Hidden = True
Rows("3:145").EntireRow.Hidden = True
ActiveSheet.Range("C1").Select
Case 6
Rows("162:210").EntireRow.Hidden = False
Rows("3:161").EntireRow.Hidden = True
ActiveSheet.Range("C1").Select
End Select
End Sub
但是当在表3(Shaker Data Entry)中更改输入时,代码将无法工作。
我不知道如何使用数据输入到表3的C13中来处理表5。