So this was my code and it worked just fine.
Private Sub ShowOnlyRowsThatAreTrue() 'This shows only the rows that are to be included
'in the systems included section
Application.ScreenUpdating = False
Dim FirstSystems_Row As Long
Dim n As Integer
Dim i As Integer
FirstSystems_Row = Cells.Find("Systems included in this proposal are as follows:", , xlValues, xlWhole).Offset(2).Row
For i = 5 To 23
If Sheet1.OLEObjects("CheckBox" & i).Object.Value = True Then
Sheet5.Rows(FirstSystems_Row).EntireRow.Hidden = False
End If
FirstSystems_Row = FirstSystems_Row + 1
Next i
Application.ScreenUpdating = True
End Sub
I wanted to error trap for when the find command doesnt find anything - so I changed my code to this and now it doesnt work. I get an COMPLILE ERROR: TYPE MISMATCH. What does that mean?
Private Sub ShowOnlyRowsThatAreTrue() 'This shows only the rows that are to be included
'in the systems included section
Application.ScreenUpdating = False
Dim FirstSystems_Row As Long
Dim n As Integer
Dim i As Integer
FirstSystems_Row = Cells.Find("Systems included in this proposal are as follows:", , xlValues, xlWhole).Offset(2).Row
If Not FirstSystems_Row Is Nothing Then
For i = 5 To 23
If Sheet1.OLEObjects("CheckBox" & i).Object.Value = True Then
Sheet5.Rows(FirstSystems_Row).EntireRow.Hidden = False
End If
FirstSystems_Row = FirstSystems_Row + 1
Next i
Else
Msgbox "ERROR! Systems included in this proposal are as follows: Text is not found on the cover letter."
Application.ScreenUpdating = True
End If
End Sub
All I changed was:
If Not FirstSystems_Row Is Nothing Then
'code
Else
Msgbox "ERROR! Systems included in this proposal are as follows: Text is not found on the cover letter."
End If
Bookmarks