gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,341
- Office Version
- 365
- Platform
- Windows
This code works except once it runs its ending up on another tab (the one after "Selected Vendors List") which tells me that once it does the VeryHidden its not goign to the next step (I think)
Can someone please help me? I need to end up back on Sheets("1 Select Vendors").Range("D10").Activate
Thanks!
Can someone please help me? I need to end up back on Sheets("1 Select Vendors").Range("D10").Activate
Thanks!
Code:
Private Sub CommandButton1_Click()
'1 Select Vendors / Selected Vendors List
'*****************************************
'Clear Selected list of Vendors
'*****************************************
Application.ScreenUpdating = False
Sheets("Selected Vendors List").Visible = True
Sheets("Selected Vendors List").Select
' Check to see if there is a tab named Step 1a
If Not Evaluate("isref(Selected Vendors List!C11)") Then
'Clear table - remove all rows except the first row
Sheet3.ListObjects("Selected_Vendors").HeaderRowRange.Select
'Remove the filters if one exists.
If ActiveSheet.FilterMode Then
Selection.AutoFilter
End If
'Clear all lines but the first one in the table leaving formulas for the next go round.
With Worksheets("Selected Vendors List").ListObjects("Selected_Vendors")
.Range.AutoFilter
On Error Resume Next
.DataBodyRange.Offset(1).Resize(.DataBodyRange.Rows.Count - 1, .DataBodyRange.Columns.Count).Rows.Delete
If .ListColumns.Count > 1 Then
.DataBodyRange.Rows(1).SpecialCells(xlCellTypeConstants).ClearContents
Else
With .DataBodyRange.Cells(1)
If Not .HasFormula Then .ClearContents
End With
End If
End With
Else
Sheets("1 Select Vendors").Range("D10").Select
Exit Sub
End If
Sheets("1 Select Vendors").Range("D10").Select
Selection.AutoFilter
ActiveWorkbook.SlicerCaches("Slicer_Name1").RequireManualUpdate = False
NamedRangeVendors
Sheets("Selected Vendors List").Visible = xlSheetVeryHidden
Application.ScreenUpdating = True
Sheets("1 Select Vendors").Range("D10").Activate
UserForm1.Hide
End Sub