title: Excel column autofiltering using VBScript
body: <p>Suppose I have a matrix like below :</p>
  
  <pre><code>     EMPID    Type Of employment
     #1 10            "T"
     #2 11            "P"
     #3 20            "P"
     #4 40            "T"
     #5 50            "T"
     #6 15            "P"
     #7 19            "T"
  </code></pre>
  
  <p><strong><em>After Filtered</em></strong></p>
  
  <pre><code>    EMPID    Type Of employment
    #2 11            "P"
    #3 20            "P"
    #6 15            "P"
  </code></pre>
  
  <p>Can you people suggest me How to do it in vbscript? I know the syntax of VBA,but in VBScipt no idea how to format?</p>
  
  <p>And after filtering If I use CountA on column#1 should I get the Row numbers as <code>3</code> or <code>7</code>?Too much confused I am here.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>  objSheet2.Range("B1").AutoFilter 2, "Parent",,,False
  </code></pre>
  
  <p><strong><em>to remove auto-filtering i used the code -</em></strong> <code>objSheet2.Rows("1:1").Select.AutoFilter</code>     but getting an error <code>Unable to get the select property of the Range Class</code></p>
  
  <p><strong>Corrected</strong>  <code>objSheet2.Range("B1").AutoFilter 2, "Parent",,,True</code>
                 <code>objSheet2.AutoFilterMode = False</code></p>
  
  <p><strong><em>Query:</em></strong> once the rows are filtered,then how would I recognize the actuall row numers of the filtered data rows,when looping over them?</p>
  
  <p><strong><em>ANSWER</em></strong></p>
  
  <pre><code>    For rowIndex=2 To objExcel1.Application.WorksheetFunction.CountA(ob1.Columns(1))
      If objSheet2.Rows(rowIndex).Hidden Then
          ' do nothing - row is filtered out
      Else
          MsgBox(rowIndex)
      End If
      Next 
  </code></pre>
  
  <p>This way I got the Filtered rows actual row number. Please advice if any better idea you guys post:-)</p>
  
  <p><strong>Screen shot</strong></p>
  
  <p><img src="https://i.stack.imgur.com/pKbrm.png" alt="enter image description here"></p>
  
  <p>Thanks</p>