JessicaKinnear
New Member
- Joined
- Jan 6, 2021
- Messages
- 25
- Office Version
- 365
- Platform
- Windows
Hey everyone, I am trying to set up the following code in my spreadsheet:
There is already this code on the sheet which references various other sheets and it works fine. However if I try to add the code above it doesn't work, and it stops all the other codes from working. Here are the codes already in the sheet
Does anyone have any idea why I can't add the other code to it, or how I can?
Thanks in advance!
Code:
If Target.CountLarge > 1 Then Exit Sub
If Target.Address(0, 0) = "C31" Then
Sheets("LL Shortfall").Rows("20:59").Hidden = True
Sheets("LL Shortfall").Rows(20).Resize(Target.Value).Hidden = False
End If
There is already this code on the sheet which references various other sheets and it works fine. However if I try to add the code above it doesn't work, and it stops all the other codes from working. Here are the codes already in the sheet
VBA Code:
Sub Jessica()
Dim i As Long
For i = 1 To 40
Sheets("Tenant " & i).Visible = Sheets("INPUTS-BUILDING DETAILS").Range("E" & i + 38) <> ""
Next i
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Address(0, 0) = "C31" Then
Rows("39:78").Hidden = True
Rows(39).Resize(Target.Value).Hidden = False
End If
If Target.CountLarge > 1 Then Exit Sub
If Target.Address(0, 0) = "C31" Then
Sheets("INTER APPORTIONMENT").Rows("27:66").Hidden = True
Sheets("INTER APPORTIONMENT").Rows(27).Resize(Target.Value).Hidden = False
End If
If Target.CountLarge > 1 Then Exit Sub
If Target.Address(0, 0) = "C31" Then
Sheets("INTER APPORTIONMENT").Rows("75:114").Hidden = True
Sheets("INTER APPORTIONMENT").Rows(75).Resize(Target.Value).Hidden = False
End If
If Target.Address = ("$C$11") Then
If Target.Text = "NET" Then
Sheets("Budget DETAILED").Columns("D").EntireColumn.Hidden = True
Sheets("Budget DETAILED").Columns("F").EntireColumn.Hidden = True
Sheets("Tenant 1").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 2").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 3").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 4").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 5").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 6").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 7").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 8").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 9").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 10").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 11").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 12").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 13").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 14").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 15").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 16").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 17").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 18").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 19").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 20").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 21").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 22").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 23").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 24").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 25").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 26").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 27").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 28").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 29").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 30").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 31").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 32").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 33").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 34").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 35").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 36").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 37").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 38").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 39").Columns("H").EntireColumn.Hidden = True
Sheets("Tenant 40").Columns("H").EntireColumn.Hidden = True
ElseIf Target.Text = "GROSS" Then
Sheets("Budget DETAILED").Columns("D").EntireColumn.Hidden = False
Sheets("Budget DETAILED").Columns("F").EntireColumn.Hidden = False
Sheets("Tenant 1").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 2").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 3").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 4").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 5").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 6").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 7").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 8").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 9").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 10").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 11").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 12").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 13").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 14").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 15").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 16").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 17").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 18").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 19").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 20").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 21").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 22").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 23").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 24").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 25").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 26").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 27").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 28").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 29").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 30").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 31").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 32").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 33").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 34").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 35").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 36").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 37").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 38").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 39").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 39").Columns("H").EntireColumn.Hidden = False
Sheets("Tenant 40").Columns("H").EntireColumn.Hidden = False
End If
End If
End Sub
Does anyone have any idea why I can't add the other code to it, or how I can?
Thanks in advance!