code not activating cell

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,341
Office Version
  1. 365
Platform
  1. 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!

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
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Trying writing your line of code like this:

VBA Code:
Private Sub CommandButton1_Click()
'Modified  2/10/2022  2:55:24 PM  EST
Application.Goto Sheets("1 Select Vendors").Range("D10")
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,827
Messages
6,121,823
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top