I have two separate macros in one worksheet, but I can't get them to both work. Below are the two macros. The red font is not part of the coding, just my notation to separate the two macros for this post. How can I code these to both work?
MACRO 1:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B3").Value = "Assumption" Then
Columns("H:J").Hidden = False
Else
Columns("H:J").Hidden = True
End If
If Range("B3").Value = "New Loan" Then
Columns("E:G").Hidden = False
Else
Columns("E:G").Hidden = True
End If
If Range("I14").Value = "Yes" And Range("B3").Value = "Assumption" Then
Columns("K:M").Hidden = False
Else
Columns("K:M").Hidden = True
End If
If Range("B4").Value = "Yes" Then
Columns("N:P").Hidden = False
Else
Columns("N:P").Hidden = True
End If
End Sub
MACRO 2:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 And Target.Row = 7 Then
If Target.Value = "Loan $" Then Target.Offset(2, 0).Formula = "=F14/F8": Target.Offset(2, 0).Interior.Color = RGB(217, 217, 217)
If Target.Value = "Loan to Cost" Then
Target.Offset(7, 0).Formula = "=F8*F9": Target.Offset(2, 0).Interior.Color = vbWhite
End If
End If
End Sub
MACRO 1:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B3").Value = "Assumption" Then
Columns("H:J").Hidden = False
Else
Columns("H:J").Hidden = True
End If
If Range("B3").Value = "New Loan" Then
Columns("E:G").Hidden = False
Else
Columns("E:G").Hidden = True
End If
If Range("I14").Value = "Yes" And Range("B3").Value = "Assumption" Then
Columns("K:M").Hidden = False
Else
Columns("K:M").Hidden = True
End If
If Range("B4").Value = "Yes" Then
Columns("N:P").Hidden = False
Else
Columns("N:P").Hidden = True
End If
End Sub
MACRO 2:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 And Target.Row = 7 Then
If Target.Value = "Loan $" Then Target.Offset(2, 0).Formula = "=F14/F8": Target.Offset(2, 0).Interior.Color = RGB(217, 217, 217)
If Target.Value = "Loan to Cost" Then
Target.Offset(7, 0).Formula = "=F8*F9": Target.Offset(2, 0).Interior.Color = vbWhite
End If
End If
End Sub