G
Gizmo
Excel2003
I can't seem to get the correct syntax to get this to work.
The Process Runs New sheet isn't filtered by cbPMSelect even if a value is
input.
It works fine if i remove the If statement.
The user inputs ModSN, PM, and CH and the sheet is filtered correctly.
I want to be able to make the PM optional and have the Chart show all the
PMs if the PMSelect is blank.
Private Sub cmdAshNUSelect_Click()
'Open Process Runs New sheet and filter
If IsEmpty(cbPMSelect) Then
GoTo Line1
Else
End If
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect Password:="XXX"
With Sheets("Process Runs New")
.Activate
.Unprotect Password:="FtMrT2008"
If .FilterMode Then
.ShowAllData
End If
.EnableAutoFilter = True
.Range("A3:AS503").AutoFilter , Field:=4, Criteria1:="<>"
.Range("A3:AS503").AutoFilter , Field:=3, Criteria1:=cbModSelect.Value
.Range("A3:AS503").AutoFilter , Field:=6, Criteria1:=cbPMSelect.Value
.Range("A3:AS503").AutoFilter , Field:=7, Criteria1:=cbCHSelect.Value
.Range("C2").Value = cbModSelect.Value
End With
Line1:
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect Password:="XXX"
With Sheets("Process Runs New")
.Activate
.Unprotect Password:="XXX"
If .FilterMode Then
.ShowAllData
End If
.EnableAutoFilter = True
.Range("A3:AS503").AutoFilter , Field:=4, Criteria1:="<>"
.Range("A3:AS503").AutoFilter , Field:=3, Criteria1:=cbModSelect.Value
.Range("A3:AS503").AutoFilter , Field:=7, Criteria1:=cbCHSelect.Value
.Range("C2").Value = cbModSelect.Value
End With
cbModSelect.Value = ""
cbPMSelect.Value = ""
cbCHSelect.Value = ""
frmChartSelect.Hide
Sheets("Ash NU Chart").Activate
Sheets("Ash NU Chart").Visible = True
Sheets("Ash Chart").Visible = False
Sheets("ChuckCalChart").Visible = False
Application.ScreenUpdating = True
ActiveWorkbook.Protect Password:="XXX"
End Sub
I can't seem to get the correct syntax to get this to work.
The Process Runs New sheet isn't filtered by cbPMSelect even if a value is
input.
It works fine if i remove the If statement.
The user inputs ModSN, PM, and CH and the sheet is filtered correctly.
I want to be able to make the PM optional and have the Chart show all the
PMs if the PMSelect is blank.
Private Sub cmdAshNUSelect_Click()
'Open Process Runs New sheet and filter
If IsEmpty(cbPMSelect) Then
GoTo Line1
Else
End If
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect Password:="XXX"
With Sheets("Process Runs New")
.Activate
.Unprotect Password:="FtMrT2008"
If .FilterMode Then
.ShowAllData
End If
.EnableAutoFilter = True
.Range("A3:AS503").AutoFilter , Field:=4, Criteria1:="<>"
.Range("A3:AS503").AutoFilter , Field:=3, Criteria1:=cbModSelect.Value
.Range("A3:AS503").AutoFilter , Field:=6, Criteria1:=cbPMSelect.Value
.Range("A3:AS503").AutoFilter , Field:=7, Criteria1:=cbCHSelect.Value
.Range("C2").Value = cbModSelect.Value
End With
Line1:
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect Password:="XXX"
With Sheets("Process Runs New")
.Activate
.Unprotect Password:="XXX"
If .FilterMode Then
.ShowAllData
End If
.EnableAutoFilter = True
.Range("A3:AS503").AutoFilter , Field:=4, Criteria1:="<>"
.Range("A3:AS503").AutoFilter , Field:=3, Criteria1:=cbModSelect.Value
.Range("A3:AS503").AutoFilter , Field:=7, Criteria1:=cbCHSelect.Value
.Range("C2").Value = cbModSelect.Value
End With
cbModSelect.Value = ""
cbPMSelect.Value = ""
cbCHSelect.Value = ""
frmChartSelect.Hide
Sheets("Ash NU Chart").Activate
Sheets("Ash NU Chart").Visible = True
Sheets("Ash Chart").Visible = False
Sheets("ChuckCalChart").Visible = False
Application.ScreenUpdating = True
ActiveWorkbook.Protect Password:="XXX"
End Sub