Q:

Read first row/column of an Excel spreadsheet with Visual Basic

I need to read the data from an Excel spreadsheet like so using Visual Basic.
v|123|t
t|123|t
g|123|t

I want to read the first column of the spreadsheet and check if it is a V or not. I'm looking to build a script that will delete everything that is not a V, but I am stuck on this.

A:

A quick method using AutoFilter. This filters out anything from the first column that isn't "v" then deletes it and removes the filter.
Sub vFilter()
With ActiveSheet
    .AutoFilterMode = False
    With Range("A1", Range("A" & Rows.Count).End(xlUp))
        .AutoFilter 1, "<>v"
        On Error Resume Next
        .EntireRow.Delete
    End With
    .AutoFilterMode = False
End With
End Sub

